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

Tests fail to run: import file mismatch #192

Closed
yurivict opened this issue Aug 3, 2021 · 3 comments
Closed

Tests fail to run: import file mismatch #192

yurivict opened this issue Aug 3, 2021 · 3 comments

Comments

@yurivict
Copy link

yurivict commented Aug 3, 2021

  • unyt version: 2.8.0
  • Python version: 3.8
  • Operating System: FreeBSD 13

Description

Running the pytest executable fails:

=========================================================================================== ERRORS ===========================================================================================
______________________________________________________________________ ERROR collecting unyt/tests/test_define_unit.py _______________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_define_unit' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_define_unit.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_define_unit.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
________________________________________________________________________ ERROR collecting unyt/tests/test_linters.py _________________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_linters' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_linters.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_linters.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
_____________________________________________________________________ ERROR collecting unyt/tests/test_mpl_interface.py ______________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_mpl_interface' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_mpl_interface.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_mpl_interface.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
_____________________________________________________________________ ERROR collecting unyt/tests/test_unit_registry.py ______________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_unit_registry' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_unit_registry.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_unit_registry.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
______________________________________________________________________ ERROR collecting unyt/tests/test_unit_systems.py ______________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_unit_systems' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_unit_systems.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_unit_systems.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
_________________________________________________________________________ ERROR collecting unyt/tests/test_units.py __________________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_units' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_units.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_units.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
_______________________________________________________________________ ERROR collecting unyt/tests/test_unyt_array.py _______________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_unyt_array' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_unyt_array.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_unyt_array.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
______________________________________________________________________ ERROR collecting unyt/tests/test_unyt_testing.py ______________________________________________________________________
import file mismatch:
imported module 'unyt.tests.test_unyt_testing' has this __file__ attribute:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/build/lib/unyt/tests/test_unyt_testing.py
which is not the same as the test file we want to collect:
  /disk-samsung/freebsd-ports/math/py-unyt/work-py38/unyt-2.8.0/unyt/tests/test_unyt_testing.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 8 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================== 8 error in 4.27 seconds ===================================================================================
*** Error code 2
@neutrinoceros
Copy link
Member

This looks like the result of a dirty install. See
pytest-dev/pytest#8978

Don't hesitate to reopen in case the error persists after cleaning your local copy.

@yurivict
Copy link
Author

yurivict commented Aug 11, 2021

In my case it's not a dirty install. The conflict is between .py files in the source tree and in the build directory,

@neutrinoceros
Copy link
Member

Can you provide more detail ? how did you install unytt ? where do you run pytest from ?

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