summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-03 13:56:05 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-03 13:56:05 (GMT)
commit76bcff27b2429d15805003ebeac8452698a61870 (patch)
tree2836230b92db267a387d45d7de23588770984261 /Lib
parent6b973747f3c5e31afd89f6a7d79bc9f3f1628710 (diff)
downloadcpython-76bcff27b2429d15805003ebeac8452698a61870.zip
cpython-76bcff27b2429d15805003ebeac8452698a61870.tar.gz
cpython-76bcff27b2429d15805003ebeac8452698a61870.tar.bz2
Issue #7317: Display full tracebacks when an error occurs asynchronously.
Patch by Alon Horev with update by Alexey Kachayev.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_cmd_line.py2
-rw-r--r--Lib/test/test_generators.py21
2 files changed, 11 insertions, 12 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index cbe1e55..4b39115 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -310,7 +310,7 @@ class CmdLineTest(unittest.TestCase):
rc, out, err = assert_python_ok('-c', code)
self.assertEqual(b'', out)
self.assertRegex(err.decode('ascii', 'ignore'),
- 'Exception OSError: .* ignored')
+ 'Exception ignored in.*\nOSError: .*')
def test_closed_stdout(self):
# Issue #13444: if stdout has been explicitly closed, we should
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 06f67c2..f5c1a7d 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1728,9 +1728,7 @@ Our ill-behaved code should be invoked during GC:
>>> g = f()
>>> next(g)
>>> del g
->>> sys.stderr.getvalue().startswith(
-... "Exception RuntimeError: 'generator ignored GeneratorExit' in "
-... )
+>>> "RuntimeError: generator ignored GeneratorExit" in sys.stderr.getvalue()
True
>>> sys.stderr = old
@@ -1840,22 +1838,23 @@ to test.
... sys.stderr = io.StringIO()
... class Leaker:
... def __del__(self):
-... raise RuntimeError
+... def invoke(message):
+... raise RuntimeError(message)
+... invoke("test")
...
... l = Leaker()
... del l
... err = sys.stderr.getvalue().strip()
-... err.startswith(
-... "Exception RuntimeError: RuntimeError() in <"
-... )
-... err.endswith("> ignored")
-... len(err.splitlines())
+... "Exception ignored in" in err
+... "RuntimeError: test" in err
+... "Traceback" in err
+... "in invoke" in err
... finally:
... sys.stderr = old
True
True
-1
-
+True
+True
These refleak tests should perhaps be in a testfile of their own,