diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 3760d45..32067bb 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -22,7 +22,7 @@ jobs: architecture: x64 - name: Run ruff run: | - pip install ruff + pip install ruff==0.1.0 ruff --version ruff check --diff . @@ -47,8 +47,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . --upgrade - pip install "mypy==1.4.1" + pip install -e ".[quality]" --upgrade - name: Run mypy run: | mypy --version diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f783baa..bf45567 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,9 +32,7 @@ jobs: python -m pip install --upgrade pip pip install -e ".[test]" --upgrade - name: Run unittests - run: | - coverage run -m pytest tests/ - coverage xml + run: pytest --cov=torchcam --cov-report xml tests/ -n auto - uses: actions/upload-artifact@v2 with: name: coverage-main @@ -44,11 +42,10 @@ jobs: runs-on: ubuntu-latest needs: pytest steps: - - uses: actions/checkout@v2 - uses: actions/download-artifact@v2 - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 with: + token: ${{ secrets.CODECOV_TOKEN }} flags: unittests fail_ci_if_error: true diff --git a/Makefile b/Makefile index aff274c..3daffc6 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ style: # Run tests for the library test: - coverage run -m pytest tests/ + pytest --cov=torchcam tests/ -n auto # Build documentation for current version single-docs: diff --git a/pyproject.toml b/pyproject.toml index 853053a..b5e52f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,14 +42,16 @@ dependencies = [ [project.optional-dependencies] test = [ - "pytest>=5.3.2", - "coverage[toml]>=4.5.4", "requests>=2.20.0,<3.0.0", "torchvision>=0.15.0,<1.0.0", + "pytest>=7.3.2", + "pytest-cov>=3.0.0,<5.0.0", + "pytest-xdist>=2.0.0,<4.0.0", + "pytest-pretty>=1.0.0,<2.0.0", ] quality = [ - "ruff>=0.0.290,<1.0.0", - "mypy==1.4.1", + "ruff==0.1.0", + "mypy==1.5.1", "black==23.3.0", "bandit[toml]>=1.7.0,<1.8.0", "pre-commit>=2.17.0,<3.0.0", @@ -71,13 +73,15 @@ demo = [ ] dev = [ # test - "pytest>=5.3.2", - "coverage[toml]>=4.5.4", "requests>=2.20.0,<3.0.0", "torchvision>=0.15.0,<1.0.0", + "pytest>=7.3.2", + "pytest-cov>=4.0.0,<5.0.0", + "pytest-xdist>=3.0.0,<4.0.0", + "pytest-pretty>=1.0.0,<2.0.0", # style - "ruff>=0.0.290,<1.0.0", - "mypy==1.4.1", + "ruff==0.1.0", + "mypy==1.5.1", "black==23.3.0", "bandit[toml]>=1.7.0,<1.8.0", "pre-commit>=2.17.0,<3.0.0", @@ -103,8 +107,8 @@ zip-safe = true [tool.setuptools.packages.find] exclude = ["demo*", "docs*", "notebooks*", "scripts*", "tests*"] -[tool.coverage.run] -source = ["torchcam"] +[tool.pytest.ini_options] +testpaths = ["torchcam/"] [tool.ruff] select = [