brendanjmeade / celeri

Next generation earthquake cycle kinematics
BSD 3-Clause "New" or "Revised" License
24 stars 6 forks source link

Error testing celeri_closure.py? #52

Closed brendanjmeade closed 2 years ago

brendanjmeade commented 2 years ago

@tbenthompson I'm seeing an error message associated with testing celeri_closure. The tests in /test/test_basic.py seem to run but there's some import related issue here that I don't quite understand. Thoughts?

Run pytest ./tests/test_basic.py ./celeri/celeri_closure.py
============================= test session starts ==============================
platform darwin -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /Users/runner/work/celeri/celeri, configfile: pyproject.toml
plugins: anyio-3.4.0
collected 3 items / 1 error / 2 selected

==================================== ERRORS ====================================
__________________ ERROR collecting celeri/celeri_closure.py ___________________
ImportError while importing test module '/Users/runner/work/celeri/celeri/celeri/celeri_closure.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/miniconda/envs/celeri/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'celeri.celeri_closure'
=========================== short test summary info ============================
ERROR celeri/celeri_closure.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.53s ===============================
Error: Process completed with exit code 2.
tbenthompson commented 2 years ago

I'm not sure. It looks like you copied this from the CI run. Can you replicate the error locally by just running pytest ./tests/test_basic.py ./celeri/celeri_closure.py from the root directory of the repo?

brendanjmeade commented 2 years ago

Thanks for the follow. I've tried this locally, and after some work changing paths, I have two contracitory results.

1 - pytest ./tests/test_basic.py ./celeri/celeri_closure.py Fails with an error related to celeri_closure!

____ ERROR collecting celeri/celericlosure.py ____ ImportError while importing test module '/Users/meade/Desktop/celeri/celeri/celeri_closure.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: ../../mambaforge/envs/celeri/lib/python3.10/importlib/init.py:126: in import_module return _bootstrap._gcd_import(name[level:], package, level) E ModuleNotFoundError: No module named 'celeri.celeri_closure'

2 - pytest ./celeri/celeri_closure.py ./tests/test_basic.py Which is the same as (1) except I've reversed the order of the tests. This one runs perfectly and all tests pass. What???

Screen Shot 2021-11-24 at 10 01 04 PM
tbenthompson commented 2 years ago

Closed via the magic of pip install --no-use-pep517 -e ..