Skip to content

Commit e12c12b

Browse files
authored
add tox config (#294)
* add basic tox config * Use tox in GitHub CI
1 parent 466082c commit e12c12b

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Uses https://github.com/ymyzk/tox-gh-actions
12
name: ci
23

34
on: [push, pull_request]
@@ -8,7 +9,7 @@ jobs:
89
runs-on: ${{ matrix.os }}
910
strategy:
1011
matrix:
11-
python-version: ["3.7", "3.8", "3.9", "3.10", '3.11.0-rc - 3.11']
12+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-rc - 3.11"]
1213

1314
os: [ubuntu-latest]
1415

@@ -20,15 +21,14 @@ jobs:
2021
with:
2122
python-version: ${{ matrix.python-version }}
2223

23-
- name: Update pip, setuptools + wheel
24+
- name: Update pip and setuptools
2425
run: |
25-
python -m pip install --upgrade pip setuptools wheel
26+
python -m pip install --upgrade pip setuptools
2627
27-
- name: Install flake8-bugbear w/dev extra install
28+
- name: Install tox and tox-gh-actions
2829
run: |
29-
python -m pip install .[dev]
30+
python -m pip install tox tox-gh-actions
3031
31-
- name: Run Unittests
32+
- name: Run tox
3233
run: |
33-
coverage run tests/test_bugbear.py
34-
coverage report -m
34+
tox

DEVELOPMENT.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ flake8-bugbear uses coverage to run standard unittest tests.
5050
/path/to/venv/bin/coverage run tests/test_bugbear.py
5151
```
5252

53+
You can also use [tox](https://tox.wiki/en/latest/index.html) to test with multiple different python versions, emulating what the CI does.
54+
55+
```console
56+
/path/to/venv/bin/tox
57+
```
58+
will by default run all tests on python versions 3.7 through 3.11. If you only want to test a specific version you can specify the environment with `-e`
59+
60+
```console
61+
/path/to/venv/bin/tox -e py38
62+
```
63+
5364
## Running linter
5465

5566
We format the code with `black` and `isort`. You can run those using `pre-commit`.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Homepage = "https://github.com/PyCQA/flake8-bugbear"
4747

4848
[project.optional-dependencies]
4949
dev = [
50+
"tox",
5051
"coverage",
5152
"hypothesis",
5253
"hypothesmith>=0.2",

tox.ini

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# The test environment and commands
2+
[tox]
3+
# default environments to run without `-e`
4+
envlist = py37, py38, py39, py310, py311
5+
6+
[gh-actions]
7+
python =
8+
3.7: py37
9+
3.8: py38
10+
3.9: py39
11+
3.10: py310
12+
"3.11.0-rc - 3.11": py311
13+
14+
[testenv:{py37, py38, py39, py310, py311}]
15+
description = Run coverage
16+
deps =
17+
coverage
18+
hypothesis
19+
hypothesmith
20+
commands =
21+
coverage run tests/test_bugbear.py {posargs}
22+
coverage report -m

0 commit comments

Comments
 (0)