Untimed: Test-run
Pytest
Tom did a test-run and found he couldn’t run the pytest locally or on docker. I looked back at it, finding I could run it locally, but got same issue on machine:
_________________________________________________ ERROR collecting test_model.py __________________________________________________
ImportError while importing test module '/tests/test_model.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_model.py:18: in <module>
from python_scripts import PODSimulation
E ImportError: No module named python_scripts
I installed nano:
apt-get install nano
Then used it to edit test_model.py
from the command line. I found that the test would run if I add __init__.py
to the python_scripts/
and myutils
directories.
I tested that this change didn’t break elsewhere - namely:
- Running experiment .py files on docker
- Running experiment .py files on local machine
- Running pytest on local machine
These all seemed fine.
Tom pulled the fix, and it then ran fine on his machine too. However, when he rebuilt his docker, he got a new issue, that test_model
has attribute:
/home/tommonks/Documents/code/stars-reproduce-hernandez-2015/reproduction/tests/test_model.py
And that that is not the same as the test file we want to collect:
/tests/test_model.py
And gave hint to remove pycache / .pyc files and/or use a unique basename for your test file modules. He removed the pycache and it ran fine. Hence, it seems it could be a problem related to having ran pytest locally first (given there is no pycache on GitHub).
Renv
Tom built the renv and recreated the figures without issue.