From 50e761a94035186a2db9fc787f157a10b52a24e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=A0oltis?= Date: Wed, 6 Mar 2024 11:18:33 +0100 Subject: [PATCH] increase cachi2 coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Ĺ oltis --- .coveragerc | 8 -------- .github/workflows/gating.yaml | 6 ++++-- cachi2/core/rooted_path.py | 3 +-- pyproject.toml | 12 ++++++++++++ tox.ini | 9 ++++++--- 5 files changed, 23 insertions(+), 15 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index b87ef3e2c..000000000 --- a/.coveragerc +++ /dev/null @@ -1,8 +0,0 @@ -[report] -skip_covered = True -show_missing = True -fail_under = 75 -exclude_lines = - pragma: no cover - if __name__ == .__main__.: - def __repr__ diff --git a/.github/workflows/gating.yaml b/.github/workflows/gating.yaml index 3ade3e656..1b9bf7a6d 100644 --- a/.github/workflows/gating.yaml +++ b/.github/workflows/gating.yaml @@ -28,7 +28,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions + pip install tox + pip install tox-gh-actions + pip install coverage - name: Test with tox run: tox - name: Run coveralls-python @@ -39,7 +41,7 @@ jobs: run: | pip3 install --upgrade pip pip3 install --upgrade setuptools - pip3 install --upgrade coveralls==3.2.0 + pip3 install --upgrade coveralls coveralls --service=github coveralls-finish: diff --git a/cachi2/core/rooted_path.py b/cachi2/core/rooted_path.py index a66da36ba..b15683544 100644 --- a/cachi2/core/rooted_path.py +++ b/cachi2/core/rooted_path.py @@ -70,9 +70,8 @@ def subpath_from_root(self) -> Path: return self._path.relative_to(self._root) def __eq__(self, other: object) -> bool: - # Note: __eq__ is implemented mainly for unit tests that do assert_called_with() or similar if not isinstance(other, RootedPath): - return NotImplemented + raise NotImplementedError(f"__eq__ not implemented for {type(other).__name__}") return self.path == other.path and self.root == other.root def __fspath__(self) -> str: diff --git a/pyproject.toml b/pyproject.toml index f92437e96..7dc55b0e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,3 +82,15 @@ disallow_untyped_decorators = true [[tool.mypy.overrides]] module = ["semver"] ignore_missing_imports = true + +[tool.coverage.report] +skip_covered = true +show_missing = true +fail_under = 80 +exclude_lines = [ + "def __repr__", + "if __name__ == .__main__.:", + "if TYPE_CHECKING:", + "raise AssertionError", + "raise NotImplementedError", +] diff --git a/tox.ini b/tox.ini index 887b05586..ec2607658 100644 --- a/tox.ini +++ b/tox.ini @@ -20,9 +20,12 @@ deps = -rrequirements-extras.txt commands = py.test \ - --ignore tests/integration \ - --cov-config .coveragerc --cov=cachi2 --cov-report term \ - --cov-report xml --cov-report html {posargs} + --ignore=tests/integration \ + --cov=cachi2 \ + --cov-config=pyproject.toml \ + --cov-report=term \ + --cov-report=html \ + --cov-report=xml {posargs} allowlist_externals = make mkdir