[pypy-commit] pypy py3.6: Merged in davidcellis/pypy/py3.6 (pull request #626)
rlamy
pypy.commits at gmail.com
Wed Sep 19 10:25:35 EDT 2018
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.6
Changeset: r95143:ea84fbbcd9bd
Date: 2018-09-19 13:43 +0000
http://bitbucket.org/pypy/pypy/changeset/ea84fbbcd9bd/
Log: Merged in davidcellis/pypy/py3.6 (pull request #626)
Add GC collects to tests expecting resource warnings
diff --git a/lib-python/3/test/lock_tests.py b/lib-python/3/test/lock_tests.py
--- a/lib-python/3/test/lock_tests.py
+++ b/lib-python/3/test/lock_tests.py
@@ -2,6 +2,7 @@
Various tests for synchronization primitives.
"""
+import gc
import sys
import time
from _thread import start_new_thread, TIMEOUT_MAX
@@ -208,6 +209,7 @@
lock = self.locktype()
ref = weakref.ref(lock)
del lock
+ gc.collect()
self.assertIsNone(ref())
diff --git a/lib-python/3/test/test_warnings/__init__.py b/lib-python/3/test/test_warnings/__init__.py
--- a/lib-python/3/test/test_warnings/__init__.py
+++ b/lib-python/3/test/test_warnings/__init__.py
@@ -848,10 +848,15 @@
with open(support.TESTFN, 'w') as fp:
fp.write(textwrap.dedent("""
+ import gc
+
def func():
f = open(__file__)
+ # Fully initialise GC for clearer error
+ gc.collect()
# Emit ResourceWarning
f = None
+ gc.collect()
func()
"""))
@@ -863,12 +868,12 @@
stderr = '\n'.join(stderr.splitlines())
stderr = re.sub('<.*>', '<...>', stderr)
expected = textwrap.dedent('''
- {fname}:5: ResourceWarning: unclosed file <...>
+ {fname}:9: ResourceWarning: unclosed file <...>
f = None
Object allocated at (most recent call first):
- File "{fname}", lineno 3
+ File "{fname}", lineno 5
f = open(__file__)
- File "{fname}", lineno 7
+ File "{fname}", lineno 12
func()
''')
expected = expected.format(fname=support.TESTFN).strip()
More information about the pypy-commit
mailing list