Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #143 +/- ##
=======================================
Coverage 71.53% 71.53%
=======================================
Files 152 152
Lines 20159 20159
Branches 3343 3343
=======================================
Hits 14420 14420
Misses 4906 4906
Partials 833 833 ☔ View full report in Codecov by Sentry. |
I disagree with this - if we remove these clauses then we have to run |
|
Will there be any path issues with the tests now effectively belonging to a package named |
|
LGTM otherwise 😄 |
You can also type
Yes, we will need to get rid of that too, at least over time, since those subclasses cannot use fixtures and parametrization decorators, see: https://docs.pytest.org/en/latest/how-to/unittest.html
I don't see any issues. A lot of packages do this: https://github.com/pydantic/pydantic/tree/main/tests, https://github.com/tiangolo/fastapi/tree/master/tests |
This PR moves the
testsdirectory outside the package.In this PR:
--userinstall in CI workflow (not sure if there was a good reason for it?).github/workflows/run_tests.py- I think we don't need this file and we can put any pytest config items intoci.yamlorpyproject.toml.testsdirectory outside package. This has some benefits, most importantly it's there is less of a danger of accidentally run the tests against the source files rather than the installed version. See also https://docs.pytest.org/en/7.1.x/explanation/goodpractices.htmltestssytems->systemsandTestMolecule->MoleculeTestSystem, etc. This is to prevent accidental collection (I believe the exact rules should betest_*.pyfilename andTest*class name and no__init__method, however I saw some issues around the collection and it's best not to cut too close to the rules and make it confusing.__init__.pyfiles, other thantests/__init__.py. This one is still needed, since we import fromtests/systems.pyandtests/common.pyand have used"--import-mode=importlib"(which is recommended, but makes imports across tests difficult). Ideally, I would like to move away from heavy cross-test importing and use a modern, fixture-based design. This will then reduce the issues around importing.if __name__ == '__main__'clauses andunittestimports. We have commited topytestnow, which is the de facto standard, let's not make it confusing by seemingly (but not really) support other modes of running the tests.