Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Speeds up test suite using plugins #222

Merged
merged 9 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading