Skip to content

Commit

Permalink
test: Speeds up test suite using plugins (#222)
Browse files Browse the repository at this point in the history
* chore: Updates pytest

* docs: Updates makefile

* ci: Updates CI

* ci: Updates codecov upload

* ci: Adds multiple builds

* ci: Fixes CI version

* style: Bumps mypy

* chore: Python 3.12 isn't supported yet

* ci: Reverts back
  • Loading branch information
frgfm authored Oct 19, 2023
1 parent 0d7a579 commit 97f91b5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 14 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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 = [
Expand Down

0 comments on commit 97f91b5

Please sign in to comment.