Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pomcho555 opened this issue Sep 17, 2021 · 1 comment

Comments

@pomcho555
Copy link

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/python@3.8/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/python@3.8/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 =============================================================================================
@Julian
Copy link
Member

Julian commented Sep 17, 2021

Hi.

The supported way of running the tests is via tox, please use that, or if you insist on using pytest directly, you can see the tox.ini for what testing dependencies you're missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants