python-socketio icon indicating copy to clipboard operation
python-socketio copied to clipboard

Test failure with .helpers import AsyncMock

Open phls opened this issue 2 years ago • 1 comments

Hi, I'm building debian package with the last version, but my tests are failing.

======================================================================
ERROR: test_namespace (unittest.loader._FailedTest.test_namespace)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_namespace
Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/loader.py", line 162, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/autopkgtest.j7o2nD/build.NdW/src/debian/tests/async/test_namespace.py", line 6, in <module>
    from .helpers import AsyncMock, _run
ImportError: attempted relative import with no known parent package


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
E
======================================================================
ERROR: test_pubsub_manager (unittest.loader._FailedTest.test_pubsub_manager)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_pubsub_manager
Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/loader.py", line 162, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/autopkgtest.j7o2nD/build.NdW/src/debian/tests/async/test_pubsub_manager.py", line 11, in <module>
    from .helpers import AsyncMock, _run
ImportError: attempted relative import with no known parent package

It seems because of: .helpers import AsyncMock, _run

But I couldn't find this module anywhere.

How can I fix that?

Thanks,

phls avatar Apr 10 '24 21:04 phls

The module is here.

I suggest you use tox to run the tests, or look at the tox configuration to learn how to create an environment that is proper for the tests. I'm not sure exactly what your mistake is, but something is wrong in your setup.

miguelgrinberg avatar Apr 10 '24 21:04 miguelgrinberg