Goal
Make the existing test suite discoverable and runnable by pytest without changing test logic or reformatting source code. This is the foundation for restoring CI (part of #3).
Current state
- Two test modules exist, both
unittest.TestCase-based and run only via python path/to/file.py:
tests/integration/reactor_tests.py — PlugFlowReactorTests (test_mole_conc, test_temperature), data-driven from tests/integration/data/pfr_test_expected_conc_*.csv (51 files).
tests/Flowsheet/flowsheet_tests.py — TestFlowsheets with 4 multi-unit scenarios, data in tests/Flowsheet/data/.
- No
conftest.py, no pytest.ini, no tests/__init__.py.
- Test data is loaded from relative paths, so tests fail when invoked from another working directory.
unittest.TestCase discovers fine under pytest, so no rewrite is required.
Tasks
Acceptance criteria
pytest tests/ -v collects and runs both modules from any working directory.
- Assimulo-dependent tests are skipped (not errored) when assimulo is absent.
- No source files outside
tests/ are modified; no black/formatting changes.
Reference
Reusable scaffolding existed in reverted PR #106 (pytest.ini, tests/conftest.py at commit 599ffb3) — adapt it, but keep this PR scoped to test discovery only.
Upstream PR
Wave 1 — strong first candidate. Test-only, touches no source files; ideal low-risk PR to open directly against CryPTSys/PharmaPy master. See the upstream strategy in #3.
Reverted PR provenance
This issue is part of the selective re-introduction of useful infrastructure from the reverted upstream work:
Implementation should stay small and reviewable, avoid repo-wide formatting, and preserve traceability through one focused PR per issue.
Goal
Make the existing test suite discoverable and runnable by
pytestwithout changing test logic or reformatting source code. This is the foundation for restoring CI (part of #3).Current state
unittest.TestCase-based and run only viapython path/to/file.py:tests/integration/reactor_tests.py—PlugFlowReactorTests(test_mole_conc,test_temperature), data-driven fromtests/integration/data/pfr_test_expected_conc_*.csv(51 files).tests/Flowsheet/flowsheet_tests.py—TestFlowsheetswith 4 multi-unit scenarios, data intests/Flowsheet/data/.conftest.py, nopytest.ini, notests/__init__.py.unittest.TestCasediscovers fine under pytest, so no rewrite is required.Tasks
tests/__init__.py(andtests/integration/__init__.py,tests/Flowsheet/__init__.pyas needed).tests/conftest.pywith fixtures:data_path→ resolvesPath(__file__).parent / ...so tests are CWD-independent.assimulo_available→ returns whetherassimuloimports; used to skip integration tests gracefully.pytest.ini(or[tool.pytest.ini_options]inpyproject.toml) with:testpaths = tests, discovery for*_tests.py/test_*.py.slow,integration,unit,assimulo.data_pathfixture /Path(__file__)instead of relative strings (minimal, surgical change only).@pytest.mark.assimuloand auto-skip when unavailable.Acceptance criteria
pytest tests/ -vcollects and runs both modules from any working directory.tests/are modified; noblack/formatting changes.Reference
Reusable scaffolding existed in reverted PR #106 (
pytest.ini,tests/conftest.pyat commit599ffb3) — adapt it, but keep this PR scoped to test discovery only.Upstream PR
Wave 1 — strong first candidate. Test-only, touches no source files; ideal low-risk PR to open directly against
CryPTSys/PharmaPymaster. See the upstream strategy in #3.Reverted PR provenance
This issue is part of the selective re-introduction of useful infrastructure from the reverted upstream work:
Implementation should stay small and reviewable, avoid repo-wide formatting, and preserve traceability through one focused PR per issue.