Skip to content

3.2.0: pytest is failing with ModuleNotFoundError: No module named 'twisted' #837

Closed
@pomcho555

Description

@pomcho555

When I run test cases including all packages on our system, this error happened. Then I have created isolated env by virtualenv, and tried test again. This result is failed following.

I think this is similar to this issue in the context of package dependency.

Environment

Python 3.8.7 (no other modules except pytest)

pip freeze

attrs==21.2.0
iniconfig==1.1.1
jsonschema==3.2.0
packaging==21.0
pluggy==1.0.0
py==1.10.0
pyparsing==2.4.7
pyrsistent==0.18.0
pytest==6.2.5
six==1.16.0
toml==0.10.2

Error trace

(venv) pomcho555@travernoMBP jsonschema % pytest
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.8.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /Users/pomcho555/workspace/jsonschema-test/venv/lib/python3.8/site-packages/jsonschema
collected 58 items / 2 errors / 56 selected

================================================================================================== ERRORS ==================================================================================================
___________________________________________________________________________ ERROR collecting tests/test_jsonschema_test_suite.py ___________________________________________________________________________
ImportError while importing test module '/Users/pomcho555/workspace/jsonschema-test/venv/lib/python3.8/site-packages/jsonschema/tests/test_jsonschema_test_suite.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_jsonschema_test_suite.py:23: in <module>
    from jsonschema.tests._suite import Suite
tests/_suite.py:13: in <module>
    from twisted.python.filepath import FilePath
E   ModuleNotFoundError: No module named 'twisted'
________________________________________________________________________________ ERROR collecting tests/test_validators.py _________________________________________________________________________________
ImportError while importing test module '/Users/pomcho555/workspace/jsonschema-test/venv/lib/python3.8/site-packages/jsonschema/tests/test_validators.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_validators.py:12: in <module>
    from twisted.trial.unittest import SynchronousTestCase
E   ModuleNotFoundError: No module named 'twisted'
========================================================================================= short test summary info ==========================================================================================
ERROR tests/test_jsonschema_test_suite.py
ERROR tests/test_validators.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================ 2 errors in 0.68s =============================================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions