diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 59631dbb..8a151531 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -46,7 +46,7 @@ jobs: - name: Useful info run: pip freeze - name: Run tests - run: pytest --cov src --cov-report xml + run: pytest --cov --cov-report xml - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 # only upload coverage reports for the first python version diff --git a/pyproject.toml b/pyproject.toml index e34e8276..e753a3db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,6 +96,16 @@ exclude_also = [ "if __name__ == '__main__':", ] +# allow for coverage to find relevant files in both src/ and */site-packages +# so that we can install the package both normally and in editable mode, and +# still get coverage for both cases using `pytest --cov` +[tool.coverage.paths] +source = ["src", "*/site-packages"] + +[tool.coverage.run] +branch = true +source = ["graph_pes"] + [tool.pytest.ini_options] # ignore all warnings coming from the pytorch_lightning package filterwarnings = [