summaryrefslogtreecommitdiff
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2008-10-28 17:01:21 +0000
committerArmin Rigo <arigo@tunes.org>2008-10-28 17:01:21 +0000
commita6d8a0ee21912a99d0e663ff1a46f1c7ed1d3a6c (patch)
treee63ba0c7eb79d1c0d0157f59cebb6acd7bf9717d /Lib/test/test_descr.py
parent58c2c68f1110c2ff9ecd07747508ab5a064d3ef6 (diff)
downloadcpython-a6d8a0ee21912a99d0e663ff1a46f1c7ed1d3a6c.tar.gz
Fix one of the tests: it relied on being present in an "output test" in
order to actually test what it was supposed to test, i.e. that the code in the __del__ method did not crash. Use instead the new helper test_support.captured_output().
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index f170d591a6..f74073811f 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1136,14 +1136,10 @@ order (MRO) for bases """
def __del__(self_):
self.assertEqual(self_.a, 1)
self.assertEqual(self_.b, 2)
-
- save_stderr = sys.stderr
- sys.stderr = sys.stdout
- h = H()
- try:
+ with test_support.captured_output('stderr') as s:
+ h = H()
del h
- finally:
- sys.stderr = save_stderr
+ self.assertEqual(s.getvalue(), '')
def test_slots_special(self):
# Testing __dict__ and __weakref__ in __slots__...