From 9f725f7c982100bc4ee7bf4b99d5b01046835f29 Mon Sep 17 00:00:00 2001
From: Nikolaus Rath <Nikolaus@rath.org>
Date: Sat, 21 Jan 2017 16:34:50 -0800
Subject: Ignore exceptions during interpreter shutdown

These can most likely be ignored in general. In the specific
case that we are addressing with this, they also seem to be
caused by a bug in Python. Closes: #851724.
---
 test/conftest.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/conftest.py b/test/conftest.py
index fa19c..d1e88 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -21,6 +21,13 @@ def register_false_checklog_pos(reg_output):
     reg_output(r'^==\d+== For counts of detected and suppressed errors, rerun with: -v')
     reg_output(r'^==\d+== ERROR SUMMARY: 0 errors from 0 contexts')
 
+    # Exception during interpreter shutdown (cf. https://bugs.debian.org/851724)
+    reg_output(r'^Exception in thread [a-z0-9_-]+ '
+               r'\(most likely raised during interpreter shutdown\):\n'
+               r'Traceback .+\n'
+               r'(  File.+\n)+'
+               r'.+: .+\n')
+
 def pytest_addoption(parser):
     group = parser.getgroup("general")
     group._addoption("--installed", action="store_true", default=False,
