Skip to content

Commit 2950977

Browse files
committed
Add configurations and documentation to run tests with Tox
1 parent 86c5cfe commit 2950977

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ reports/
1111

1212
*.pyc
1313
.pytest_cache
14+
.tox
1415
__pycache__
1516
.DS_Store
1617

development.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,17 @@ pytest
4343

4444
This will run all tests located in the `tests/` directory.
4545

46-
## Running Tests with Coverage
46+
### Running Tests with multiple Python versions
47+
48+
Multiple versions of Python can be tested using Tox. Versions 3.9-3.13 are supported. To have Tox run the tests, simply call its command:
49+
50+
```sh
51+
tox
52+
```
53+
54+
Tox will create an isolated environment for each Python version to run the tests in.
55+
56+
### Running Tests with Coverage
4757

4858
To run the tests and generate coverage reports, use the following command:
4959

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"pytest-cov >= 5.0.0",
4040
"pytest-mock >= 3.14.0",
4141
"pytest-sugar >= 1.0.0",
42+
"tox >= 4.23.2",
4243
]
4344

4445
[project.urls]
@@ -209,6 +210,15 @@
209210
testpaths = ["tests"]
210211

211212

213+
[tool.tox]
214+
envlist = ["py39", "py310", "py311", "py312", "py313"]
215+
216+
[tool.tox.env_run_base]
217+
deps = [".[dev]"]
218+
commands = [["pytest", "tests/"]]
219+
allowlist_externals = ["echo"]
220+
221+
212222
[tool.coverage.run] # Configure coverage.py to measure branch coverage and specify source files to be measured.
213223
branch = true # Enable branch coverage
214224
source = ["streamdeck"] # Specify the source files for coverage.

0 commit comments

Comments
 (0)