Skip to content

Commit 2985bca

Browse files
authoredMar 18, 2025··
Merge pull request #2378 from kurtmckee/tox
Add tox for cross-platform, parallel test suite execution
2 parents 77827d2 + 567a729 commit 2985bca

File tree

6 files changed

+154
-34
lines changed

6 files changed

+154
-34
lines changed
 

‎.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
run: uv sync --all-extras --frozen
3434

3535
- name: Lint
36-
run: ./scripts/lint.sh
36+
run: uv run --with tox-uv tox -e lint

‎.github/workflows/test.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ jobs:
3838
run: uv sync --all-extras --frozen
3939

4040
- name: Test
41-
shell: bash
42-
run: ./scripts/test.sh
41+
run: uv run --with tox-uv tox -e py,coverage_report-ci
4342

4443
- name: Report Coverage
4544
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

‎pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ tests = ["tests", "*/tests"]
7676

7777
[tool.coverage.run]
7878
branch = true
79+
parallel = true
7980
source = ["isort", "tests"]
8081
omit = [
8182
"isort/_vendored/*",
@@ -141,6 +142,8 @@ dev = [
141142
"ruff>=0.9.6",
142143
"stdlibs>=2024.10.21.16",
143144
"toml>=0.10.2",
145+
"tox>=4.24.1",
146+
"tox-uv>=1.25.0",
144147
"types-colorama>=0.4.2",
145148
"types-setuptools>=70.0.0.20240523",
146149
"types-toml>=0.1.3",

‎scripts/lint.sh

-11
This file was deleted.

‎tox.ini

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[tox]
2+
env_list =
3+
coverage_erase
4+
# When updating the list of Python versions to test,
5+
# use search-and-replace to ensure that intra-environment
6+
# dependencies are maintained for parallel execution.
7+
py{3.13, 3.12, 3.11, 3.10, 3.9}
8+
coverage_report
9+
mypy
10+
11+
12+
[testenv:coverage_erase]
13+
description = Erase coverage files
14+
dependency_groups =
15+
dev
16+
commands =
17+
coverage erase
18+
19+
20+
[testenv]
21+
runner = uv-venv-lock-runner
22+
dependency_groups =
23+
dev
24+
depends =
25+
py{3.13, 3.12, 3.11, 3.10, 3.9}: coverage_erase
26+
commands =
27+
coverage run -m pytest tests/unit/ -s --ignore=tests/unit/test_deprecated_finders.py
28+
29+
30+
[testenv:coverage_report{,-ci}]
31+
description = Create a coverage report
32+
depends =
33+
py{3.13, 3.12, 3.11, 3.10, 3.9}
34+
dependency_groups =
35+
dev
36+
commands_pre =
37+
# `coverage combine` will fail if run twice in a row.
38+
# The '-' ignores failures.
39+
- coverage combine
40+
# Only write an HTML reports when NOT running in CI.
41+
# Also, ignore the exit code if coverage falls below the fail_under value.
42+
!ci: - coverage html
43+
commands =
44+
coverage report
45+
commands_post =
46+
# Only write an XML report when running in CI.
47+
ci: coverage xml
48+
49+
50+
[testenv:lint]
51+
description = Lint the project
52+
skip_install = true
53+
dependency_groups =
54+
dev
55+
commands =
56+
cruft check
57+
mypy -p isort -p tests
58+
black --target-version py39 --check .
59+
isort --profile hug --check --diff isort/ tests/
60+
isort --profile hug --check --diff example_isort_formatting_plugin/
61+
isort --profile hug --check --diff example_isort_sorting_plugin/
62+
isort --profile hug --check --diff example_shared_isort_profile/
63+
flake8 isort/ tests/
64+
ruff check
65+
bandit -r isort/ -x isort/_vendored

‎uv.lock

+84-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.