[pypy-commit] pypy py3.6: Add GC collects to test_tracemalloc - Now gives the expected warning
David C Ellis
pypy.commits at gmail.com
Wed Sep 19 10:26:28 EDT 2018
Author: David C Ellis <ducksual at gmail.com>
Branch: py3.6
Changeset: r95142:7eda7fcc5e0f
Date: 2018-09-19 14:06 +0100
http://bitbucket.org/pypy/pypy/changeset/7eda7fcc5e0f/
Log: Add GC collects to test_tracemalloc - Now gives the expected warning
Test still fails as the message is different
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