pypy/module/_io/test/apptest_io.py::test_warn_on_dealloc
tempfile = W_UnicodeObject('d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-351\\tempfile')
def test_warn_on_dealloc(tempfile):
> _check_warn_on_dealloc(tempfile, 'wb', buffering=0)
module\_io\test\apptest_io.py:376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = W_TupleObject(W_UnicodeObject('d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-351\\tempfile'), W_UnicodeObject('wb'))
kwargs = W_DictObject(<pypy.objspace.std.kwargsdict.KwargsDictStrategy object at 0x0000023334c771a0>)
gc = <pypy.module.gc.moduledef.Module object at 0x000002333422ad40>
warnings = <pypy.interpreter.module.Module object at 0x00000233321b5da8>
f = <pypy.objspace.std.noneobject.W_NoneObject object at 0x0000023331645f68>
r = W_UnicodeObject("<_io.FileIO name='d:\\\\systemtemp\\\\pytest\\\\pytest-of-matti\\\\pytest-351\\\\tempfile' mode='wb' closefd=True>")
w = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000...reter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000002333e5962f8>])
@py_assert2 = <pypy.objspace.std.noneobject.W_NoneObject object at 0x0000023331645f68>
@py_assert5 = W_UnicodeObject('{message : ResourceWarning("unclosed file <_io.FileIO name=\'...\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}')
@py_assert4 = <pypy.objspace.std.noneobject.W_NoneObject object at 0x0000023331645f68>
@py_format7 = W_UnicodeObject('"<_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest\\\\\\\...ne : None}\' = str(<warnings.WarningMessage object at 0x000002333e5962f8>)\n}')
@py_format9 = W_UnicodeObject('assert "<_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest...ne : None}\' = str(<warnings.WarningMessage object at 0x000002333e5962f8>)\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 (application-level) AssertionError: assert "<_io.FileIO name='d:\\\\systemtemp\\\\pytest\\\\pytest-of-matti\\\\pytest-351\\\\tempfile' mode='wb' closefd=True>" in '{message : ResourceWarning("unclosed file <_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest\\\\\\\\pytest-of-matti\\\\\\\\pytest-351\\\\\\\\tempfile\' mode=\'wb\' closefd=True>"), category : \'ResourceWarning\', filename : \'d:\\\\pypy_stuff\\\\buildbot64\\\\slave\\\\own-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\\\\\\\\pytest-of-matti\\\\\\\\pytest-351\\\\\\\\tempfile\' mode=\'wb\' closefd=True>"), category : \'ResourceWarning\', filename : \'d:\\\\pypy_stuff\\\\buildbot64\\\\slave\\\\own-win-x86-64\\\\build\\\\pypy\\\\module\\\\_io\\\\test\\\\apptest_io.py\', lineno : 371, line : None}' = str(<warnings.WarningMessage object at 0x000002333e5962f8>)
module\_io\test\apptest_io.py:373: AssertionError
builder: own-win-x86-64 build #2232
test: pypy/module/_io/test/apptest_io/py/test_warn_on_dealloc