pypy.module._io.test.apptest_io:test_warn_on_dealloc
tempfile = 'D:\\SystemTemp\\pytest-of-matti\\pytest-1033\\test_warn_on_dealloc0\\tempfile'
def test_warn_on_dealloc(tempfile):
> _check_warn_on_dealloc(tempfile, 'wb', buffering=0)
..\build\pypy\module\_io\test\apptest_io.py:376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ('D:\\SystemTemp\\pytest-of-matti\\pytest-1033\\test_warn_on_dealloc0\\tempfile', 'wb')
kwargs = {'buffering': 0}, gc = <module 'gc' (built-in)>
warnings = <module 'warnings' from 'D:\\pypy_stuff\\buildbot64\\slave\\pypy-c-jit-win-x86-64\\build\\lib-python\\3\\warnings.py'>
f = None
r = "<_io.FileIO name='D:\\\\SystemTemp\\\\pytest-of-matti\\\\pytest-1033\\\\test_warn_on_dealloc0\\\\tempfile' mode='wb' closefd=True>"
w = [<warnings.WarningMessage object at 0x0000028c24e6c2f8>], @py_assert2 = None
@py_assert5 = '{message : ResourceWarning("unclosed file <_io.FileIO name=\'D:\\\\\\\\SystemTemp\\\\\\\\pytest-of-matti\\\\\\\\pytes...lave\\\\pypy-c-jit-win-x86-64\\\\build\\\\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}'
@py_assert4 = None
@py_format7 = '"<_io.FileIO name=\'D:\\\\\\\\SystemTemp\\\\\\\\pytest-of-matti\\\\\\\\pytest-1033\\\\\\\\test_warn_on_dealloc0\\\\\\...\\\\\\apptest_io.py\\\', lineno : 371, line : None}\' = str(<warnings.WarningMessage object at 0x0000028c24e6c2f8>)\n}'
@py_format9 = 'assert "<_io.FileIO name=\'D:\\\\\\\\SystemTemp\\\\\\\\pytest-of-matti\\\\\\\\pytest-1033\\\\\\\\test_warn_on_dealloc...\\\\\\apptest_io.py\\\', lineno : 371, line : None}\' = str(<warnings.WarningMessage object at 0x0000028c24e6c2f8>)\n}'
def _check_warn_on_dealloc(*args, **kwargs):
import gc
import warnings
f = open(*args, **kwargs)
r = repr(f)
gc.collect()
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
f = None
gc.collect()
assert len(w) == 1, len(w)
> assert r in str(w[0])
E assert "<_io.FileIO name='D:\\\\SystemTemp\\\\pytest-of-matti\\\\pytest-1033\\\\test_warn_on_dealloc0\\\\tempfile' mode='wb' closefd=True>" in '{message : ResourceWarning("unclosed file <_io.FileIO name=\'D:\\\\\\\\SystemTemp\\\\\\\\pytest-of-matti\\\\\\\\pytes...lave\\\\pypy-c-jit-win-x86-64\\\\build\\\\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}'
E + where '{message : ResourceWarning("unclosed file <_io.FileIO name=\'D:\\\\\\\\SystemTemp\\\\\\\\pytest-of-matti\\\\\\\\pytes...lave\\\\pypy-c-jit-win-x86-64\\\\build\\\\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}' = str(<warnings.WarningMessage object at 0x0000028c24e6c2f8>)
..\build\pypy\module\_io\test\apptest_io.py:373: AssertionError
builder: pypy-c-jit-win-x86-64 build #2356
test: pypy/module/_io/test/apptest_io:test_warn_on_dealloc