Skip to content

Commit

Permalink
Add testing duration improvements (#440)
Browse files Browse the repository at this point in the history
* Install pytest xdist plugin

* Run tests with pytest-xdist

* Use mypy cache in tox

This makes running mypy from tox much
faster (e.g., with `tox -e typing`).

* Store and load mypy cache in GH workflow

* Use `black` cache in tox

* Add `pytest-cov` plugin

In order to get coverage when using the
`pytest-xdist` plugin we should use
`pytest-cov`.

* Move `pytest-xdist` to dev-packages in Pipfile

---------

Co-authored-by: Martin Vrachev <[email protected]>
  • Loading branch information
KAUTH and MVrachev authored Nov 17, 2023
1 parent 7c025d4 commit ff03607
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 141 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = tests/*
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,25 @@ jobs:
- name: Test Build binary wheel and source tarball
run: python3 -m build --sdist --wheel --outdir dist/ .

- name: Restore mypy cache
id: cache-mypy-restore
uses: actions/cache/restore@v3
with:
path: |
.mypy_cache
key: ${{ runner.os }}-py${{ matrix.python-versions }}-mypy-${{ hashFiles('**/.mypy_cache') }}

- name: Run Python tests
run: make tests
run: |
make tests
- name: Save mypy cache
id: cache-mypy-save
uses: actions/cache/save@v3
with:
path: |
.mypy_cache
key: ${{ runner.os }}-py${{ matrix.python-versions }}-mypy-${{ hashFiles('**/.mypy_cache') }}

- name: Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
Expand Down
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ isort = "*"
flake8 = "*"
tox = "*"
pytest = "*"
pytest-cov = "*"
pytest-xdist = "*"
coverage = "*"
mypy = "*"
pip = "*"
Expand Down
80 changes: 44 additions & 36 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ff03607

Please sign in to comment.