[Python-checkins] cpython (3.6): Fix test_huntrleaks_fd_leak() of test_regrtest

victor.stinner python-checkins at python.org
Sun Sep 18 18:13:32 EDT 2016


https://hg.python.org/cpython/rev/91285b24f1c2
changeset:   103930:91285b24f1c2
branch:      3.6
parent:      103928:b56290a80ff7
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Sep 19 00:11:30 2016 +0200
summary:
  Fix test_huntrleaks_fd_leak() of test_regrtest

Issue #28195: Don't expect the fd leak message to be on a specific line number,
just make sure that the line is present in the output.

files:
  Lib/test/test_regrtest.py |  7 ++-----
  1 files changed, 2 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -772,14 +772,11 @@
         self.check_line(output, re.escape(line))
 
         line2 = '%s leaked [1, 1, 1] file descriptors, sum=3\n' % test
-        self.check_line(output, re.escape(line2))
+        self.assertIn(line2, output)
 
         with open(filename) as fp:
             reflog = fp.read()
-            if hasattr(sys, 'getcounts'):
-                # Types are immportal if COUNT_ALLOCS is defined
-                reflog = reflog.splitlines(True)[-1]
-            self.assertEqual(reflog, line2)
+            self.assertIn(line2, reflog)
 
     def test_list_tests(self):
         # test --list-tests

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list