Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/_io/test/apptest_io.py::test_warn_on_dealloc

tempfile = W_UnicodeObject('d:\\systemtemp\\pytest\\pytest-of-matti\\pytest-550\\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-550\\tempfile'), W_UnicodeObject('wb'))
kwargs = W_DictObject(<pypy.objspace.std.kwargsdict.KwargsDictStrategy object at 0x000001da8b52b590>)
gc = <pypy.module.gc.moduledef.Module object at 0x000001da8a3023a0>
warnings = <pypy.interpreter.module.Module object at 0x000001da8a44e448>
f = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000001da87f5e218>
r = W_UnicodeObject("<_io.FileIO name='d:\\\\systemtemp\\\\pytest\\\\pytest-of-matti\\\\pytest-550\\\\tempfile' mode='wb' closefd=True>")
w = W_ListObject(<pypy.objspace.std.listobject.ObjectListStrategy object at 0x0000...reter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001da94cf59b8>])
@py_assert2 = <pypy.objspace.std.noneobject.W_NoneObject object at 0x000001da87f5e218>
@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 0x000001da87f5e218>
@py_format7 = W_UnicodeObject('"<_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest\\\\\\\...ne : None}\' = str(<warnings.WarningMessage object at 0x000001da94cf59b8>)\n}')
@py_format9 = W_UnicodeObject('assert "<_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest...ne : None}\' = str(<warnings.WarningMessage object at 0x000001da94cf59b8>)\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-550\\\\tempfile' mode='wb' closefd=True>" in '{message : ResourceWarning("unclosed file <_io.FileIO name=\'d:\\\\\\\\systemtemp\\\\\\\\pytest\\\\\\\\pytest-of-matti\\\\\\\\pytest-550\\\\\\\\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-550\\\\\\\\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 0x000001da94cf59b8>)

module\_io\test\apptest_io.py:373: AssertionError
builder: own-win-x86-64 build #2237
test: pypy/module/_io/test/apptest_io/py/test_warn_on_dealloc