Skip to content

Commit

Permalink
Use tox to run the test suite against all supported Pythons
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtmckee authored and michaelmior committed Nov 11, 2023
1 parent b974d4f commit bab8e4a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[run]
parallel = True
branch = True
source = jsonpath_ng, tests

[report]
fail_under = 82
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run tests
run: make test
run: tox run -e py${{ matrix.python-version }}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
\#(
.\#*

# Built artifacts
# Build and test artifacts
/README.txt
/dist
/*.egg-info
parser.out
.coverage
.cache
.coverage
.coverage.*
.tox/

build
/jsonpath_rw/VERSION
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ lint:
@flake8 --exclude=tests .

test: clean
@echo "$(OK_COLOR)==> Runnings tests ...$(NO_COLOR)"
@pytest -s -v --capture sys --cov jsonpath_ng --cov-report term-missing

coverage:
@coverage run --source jsonpath_ng -m pytest
@coverage report
@echo "$(OK_COLOR)==> Running tests ...$(NO_COLOR)"
@tox

tag:
@echo "$(OK_COLOR)==> Creating tag $(version) ...$(NO_COLOR)"
Expand Down
5 changes: 1 addition & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
pytest
tox
flake8
coverage
pytest-cov
pytest-randomly
48 changes: 48 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[tox]
min_version = 4.3.5

envlist =
coverage-erase
py{3.12, 3.11, 3.10, 3.9, 3.8, 3.7}
coverage-report

skip_missing_interpreters = True
isolated_build = True


[testenv]
package = wheel
wheel_build_env = build_wheel

depends =
py{3.12, 3.11, 3.10, 3.9, 3.8, 3.7}: coverage-erase
deps =
coverage[toml]
pytest
pytest-randomly
commands =
coverage run -m pytest


[testenv:coverage-erase]
no_package = true
skip_install = true
deps =
coverage[toml]
commands =
coverage erase


[testenv:coverage-report]
depends =
py{3.12, 3.11, 3.10, 3.9, 3.8, 3.7}
no_package = true
skip_install = true
deps =
coverage[toml]
commands_pre =
- coverage combine
commands =
coverage report
command_post =
coverage html --fail-under=0

0 comments on commit bab8e4a

Please sign in to comment.