uqfoundation / dill

serialize all of Python

Home Page:http://dill.rtfd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests fail

yurivict opened this issue · comments

========================================================================================== test session starts ==========================================================================================
platform freebsd13 -- Python 3.9.16, pytest-7.2.1, pluggy-1.0.0 -- /usr/local/bin/python3.9
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/usr/ports/devel/py-dill/work-py39/dill-0.3.6/.hypothesis/examples')
rootdir: /usr/ports/devel/py-dill/work-py39/dill-0.3.6
plugins: forked-1.4.0, hypothesis-6.65.2, cov-2.9.0, mypy-plugins-1.10.1, timeout-2.1.0, xdist-2.5.0
collected 78 items / 7 errors                                                                                                                                                                           

================================================================================================ ERRORS =================================================================================================
_______________________________________________________________________________ ERROR collecting dill/tests/test_diff.py ________________________________________________________________________________
dill/tests/test_diff.py:9: in <module>
    from dill import __diff as diff
dill/__diff.py:233: in <module>
    memorise(mod)
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:119: in memorise
    [mem(item) for item in s]
dill/__diff.py:119: in <listcomp>
    [mem(item) for item in s]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:115: in memorise
    [(mem(key), mem(item))
dill/__diff.py:115: in <listcomp>
    [(mem(key), mem(item))
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:91: in memorise
    g = get_attrs(obj)
dill/__diff.py:44: in get_attrs
    return getattr(obj, '__dict__', None)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:177: in __dict__
    self.__makeattr(name)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:157: in __makeattr
    result = importobj(modpath, attrname)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:75: in importobj
    module = __import__(modpath, None, None, ["__doc__"])
dill/__diff.py:223: in _imp
    memorise(sys.modules[m])
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:91: in memorise
    g = get_attrs(obj)
dill/__diff.py:44: in get_attrs
    return getattr(obj, '__dict__', None)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:177: in __dict__
    self.__makeattr(name)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:157: in __makeattr
    result = importobj(modpath, attrname)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:75: in importobj
    module = __import__(modpath, None, None, ["__doc__"])
dill/__diff.py:223: in _imp
    memorise(sys.modules[m])
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:91: in memorise
    g = get_attrs(obj)
dill/__diff.py:44: in get_attrs
    return getattr(obj, '__dict__', None)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:177: in __dict__
    self.__makeattr(name)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:157: in __makeattr
    result = importobj(modpath, attrname)
/usr/local/lib/python3.9/site-packages/py/_vendored_packages/apipkg/__init__.py:75: in importobj
    module = __import__(modpath, None, None, ["__doc__"])
dill/__diff.py:223: in _imp
    memorise(sys.modules[m])
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
E   RuntimeError: dictionary changed size during iteration
______________________________________________________________________________ ERROR collecting dill/tests/test_module.py _______________________________________________________________________________
ImportError while importing test module '/usr/ports/devel/py-dill/work-py39/dill-0.3.6/dill/tests/test_module.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
dill/tests/test_module.py:11: in <module>
    import test_mixins as module
dill/__diff.py:220: in _imp
    mod = __import__(*args, **kwds)
E   ModuleNotFoundError: No module named 'test_mixins'
____________________________________________________________________________ ERROR collecting dill/tests/test_moduledict.py _____________________________________________________________________________
dill/tests/test_moduledict.py:25: in <module>
    import doctest
dill/__diff.py:223: in _imp
    memorise(sys.modules[m])
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:101: in memorise
    seq_id = dict((id_(key),id_(value)) for key, value in s.items())
dill/__diff.py:101: in <genexpr>
    seq_id = dict((id_(key),id_(value)) for key, value in s.items())
E   ValueError: too many values to unpack (expected 2)
______________________________________________________________________________ ERROR collecting dill/tests/test_objects.py ______________________________________________________________________________
dill/tests/test_objects.py:20: in <module>
    load_types(pickleable=True,unpickleable=False)
dill/__init__.py:72: in load_types
    from . import _objects
dill/__diff.py:223: in _imp
    memorise(sys.modules[m])
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:115: in memorise
    [(mem(key), mem(item))
dill/__diff.py:115: in <listcomp>
    [(mem(key), mem(item))
dill/__diff.py:91: in memorise
    g = get_attrs(obj)
dill/__diff.py:44: in get_attrs
    return getattr(obj, '__dict__', None)
E   ReferenceError: weakly-referenced object no longer exists
____________________________________________________________________________ ERROR collecting dill/tests/test_registered.py _____________________________________________________________________________
dill/tests/test_registered.py:35: in <module>
    raise e from None
dill/tests/test_registered.py:32: in <module>
    assert not bool(success)
E   AssertionError: assert not True
E    +  where True = bool(['PrettyPrinterType', 'StreamHandlerType'])
-------------------------------------------------------------------------------------------- Captured stdout --------------------------------------------------------------------------------------------
SUCCESS: ['PrettyPrinterType', 'StreamHandlerType']
_____________________________________________________________________________ ERROR collecting dill/tests/test_selected.py ______________________________________________________________________________
dill/tests/test_selected.py:46: in <module>
    objects['TemporaryFileType'].close()
E   OSError: [Errno 9] Bad file descriptor
______________________________________________________________________________ ERROR collecting dill/tests/test_session.py ______________________________________________________________________________
ImportError while importing test module '/usr/ports/devel/py-dill/work-py39/dill-0.3.6/dill/tests/test_session.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
dill/tests/test_session.py:72: in <module>
    import test_dictviews as local_mod                  # non-builtin top-level module
dill/__diff.py:220: in _imp
    mod = __import__(*args, **kwds)
E   ModuleNotFoundError: No module named 'test_dictviews'
=========================================================================================== warnings summary ============================================================================================
dill/__diff.py:69
  /usr/ports/devel/py-dill/work-py39/dill-0.3.6/dill/__diff.py:69: PyStdIsDeprecatedWarning: py.std is deprecated, please import __contains__ directly
    elif hsattr(obj, "__contains__") and hsattr(obj, "__iter__") \

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 7 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===================================================================================== 1 warning, 7 errors in 2.17s ======================================================================================
*** Error code 2

Version: 0.3.6
Python-3.9
FreeBSD 13.1

Is this a duplicate of #460 or #329? If so, it should be closed. If not, let me know what's different.

Some of them looks new:

> ____________________________________________________________________________ ERROR collecting dill/tests/test_moduledict.py _____________________________________________________________________________
> dill/tests/test_moduledict.py:25: in <module>
>     import doctest
> dill/__diff.py:223: in _imp
>     memorise(sys.modules[m])
> dill/__diff.py:111: in memorise
>     [mem(value) for key, value in g.items()]
> dill/__diff.py:111: in <listcomp>
>     [mem(value) for key, value in g.items()]
> dill/__diff.py:111: in memorise
>     [mem(value) for key, value in g.items()]
> dill/__diff.py:111: in <listcomp>
>     [mem(value) for key, value in g.items()]
> dill/__diff.py:111: in memorise
>     [mem(value) for key, value in g.items()]
> dill/__diff.py:111: in <listcomp>
>     [mem(value) for key, value in g.items()]
> dill/__diff.py:101: in memorise
>     seq_id = dict((id_(key),id_(value)) for key, value in s.items())
> dill/__diff.py:101: in <genexpr>
>     seq_id = dict((id_(key),id_(value)) for key, value in s.items())
> E   ValueError: too many values to unpack (expected 2)
> ____________________________________________________________________________ ERROR collecting dill/tests/test_registered.py _____________________________________________________________________________
> dill/tests/test_registered.py:35: in <module>
>     raise e from None
> dill/tests/test_registered.py:32: in <module>
>     assert not bool(success)
> E   AssertionError: assert not True
> E    +  where True = bool(['PrettyPrinterType', 'StreamHandlerType'])
> -------------------------------------------------------------------------------------------- Captured stdout --------------------------------------------------------------------------------------------
> SUCCESS: ['PrettyPrinterType', 'StreamHandlerType']
> _____________________________________________________________________________ ERROR collecting dill/tests/test_selected.py ______________________________________________________________________________
> dill/tests/test_selected.py:46: in <module>
>     objects['TemporaryFileType'].close()
> E   OSError: [Errno 9] Bad file descriptor

@olegsidorkin: yes, some of the test failures/successes have changed when pytest is run. However, essentially, if the request is for pytest to work on the dill test suite, then it's a duplicate of the above two issues.

And what is the preferred way to test dill ? Just run all functions with python?

I may eventually make sure pytest works, as it's somewhat of a standard. However, as mentioned in the other issues, pytest has some difficulty with testing geared for serialization and multiprocessing. I'll see what I can do. But to answer your question, testing is generally done with python -m dill.tests or running __main__ in dill.tests.

I have very simillar resul with python 3.8.16
Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-dill-0.3.6-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-dill-0.3.6-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/dill-dill-0.3.6
collected 83 items / 5 errors

==================================== ERRORS ====================================
__________________ ERROR collecting dill/tests/test_module.py __________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/dill-dill-0.3.6/dill/tests/test_module.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
dill/tests/test_module.py:11: in <module>
    import test_mixins as module
dill/__diff.py:220: in _imp
    mod = __import__(*args, **kwds)
E   ModuleNotFoundError: No module named 'test_mixins'
_________________ ERROR collecting dill/tests/test_objects.py __________________
dill/tests/test_objects.py:20: in <module>
    load_types(pickleable=True,unpickleable=False)
dill/__init__.py:72: in load_types
    from . import _objects
dill/__diff.py:223: in _imp
    memorise(sys.modules[m])
dill/__diff.py:111: in memorise
    [mem(value) for key, value in g.items()]
dill/__diff.py:111: in <listcomp>
    [mem(value) for key, value in g.items()]
dill/__diff.py:115: in memorise
    [(mem(key), mem(item))
dill/__diff.py:115: in <listcomp>
    [(mem(key), mem(item))
dill/__diff.py:91: in memorise
    g = get_attrs(obj)
dill/__diff.py:44: in get_attrs
    return getattr(obj, '__dict__', None)
E   ReferenceError: weakly-referenced object no longer exists
________________ ERROR collecting dill/tests/test_registered.py ________________
dill/tests/test_registered.py:35: in <module>
    raise e from None
dill/tests/test_registered.py:32: in <module>
    assert not bool(success)
E   AssertionError: assert not True
E    +  where True = bool(['PrettyPrinterType', 'StreamHandlerType'])
------------------------------- Captured stdout --------------------------------
SUCCESS: ['PrettyPrinterType', 'StreamHandlerType']
_________________ ERROR collecting dill/tests/test_selected.py _________________
dill/tests/test_selected.py:46: in <module>
    objects['TemporaryFileType'].close()
E   OSError: [Errno 9] Bad file descriptor
_________________ ERROR collecting dill/tests/test_session.py __________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/dill-dill-0.3.6/dill/tests/test_session.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
dill/tests/test_session.py:72: in <module>
    import test_dictviews as local_mod                  # non-builtin top-level module
dill/__diff.py:220: in _imp
    mod = __import__(*args, **kwds)
E   ModuleNotFoundError: No module named 'test_dictviews'
=========================== short test summary info ============================
ERROR dill/tests/test_module.py
ERROR dill/tests/test_objects.py - ReferenceError: weakly-referenced object n...
ERROR dill/tests/test_registered.py - AssertionError: assert not True
ERROR dill/tests/test_selected.py - OSError: [Errno 9] Bad file descriptor
ERROR dill/tests/test_session.py
!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 5 errors in 0.90s ===============================

gentle ping .. any update? 🤔

No update. pytest is not supported. Closing this as duplicate.