Skip to content

Commit

Permalink
DEV: Use pytest-xdist (#2254)
Browse files Browse the repository at this point in the history
This was added so that CI goes down from about 14min 23s to about 9min 20s

Please note that individual runs depend heavily on factors outside of our control (likely Github CI test runner hardware)
  • Loading branch information
MartinThoma authored Oct 17, 2023
1 parent 448c379 commit 8aef1de
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 8 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/github-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ jobs:
python -c "from tests import download_test_pdfs; download_test_pdfs()"
- name: Test with pytest
run: |
python -m coverage run --parallel-mode -m pytest tests -vv
python -m pytest tests --cov=pypdf --cov-append -n auto -vv
- name: Rename coverage data file
run: mv .coverage ".coverage.$RANDOM"
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -170,6 +172,16 @@ jobs:
with:
name: coverage-data

- name: Check Number of Downloaded Files
run: |
downloaded_files_count=$(find \.coverage* -type f | wc -l)
if [ $downloaded_files_count -eq 7 ]; then
echo "The expected number of files (7) were downloaded."
else
echo "ERROR: Expected 7 files, but found $downloaded_files_count files."
exit 1
fi
- name: Combine coverage & create xml report
run: |
python -m coverage combine
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ crypto = [
"PyCryptodome; python_version == '3.6'",
]
image = ["Pillow>=8.0.0"]
dev = ["black", "pip-tools", "pre-commit<2.18.0", "pytest-cov", "pytest-socket", "pytest-timeout", "flit", "wheel"]
dev = ["black", "pip-tools", "pre-commit<2.18.0", "pytest-cov", "pytest-socket", "pytest-timeout", "flit", "wheel", "pytest-xdist"]
docs = ["sphinx", "sphinx_rtd_theme", "myst_parser"]

[tool.mutmut]
Expand Down
14 changes: 12 additions & 2 deletions requirements/ci-3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
#
attrs==23.1.0
# via flake8-bugbear
coverage==7.3.0
# via -r requirements/ci.in
coverage[toml]==7.3.0
# via
# -r requirements/ci.in
# pytest-cov
execnet==2.0.2
# via pytest-xdist
flake8==6.1.0
# via
# -r requirements/ci.in
Expand Down Expand Up @@ -51,14 +55,20 @@ pytest==7.4.0
# via
# -r requirements/ci.in
# pytest-benchmark
# pytest-cov
# pytest-socket
# pytest-timeout
# pytest-xdist
pytest-benchmark==4.0.0
# via -r requirements/ci.in
pytest-cov==4.1.0
# via -r requirements/ci.in
pytest-socket==0.6.0
# via -r requirements/ci.in
pytest-timeout==2.1.0
# via -r requirements/ci.in
pytest-xdist==3.3.1
# via -r requirements/ci.in
ruff==0.0.290
# via -r requirements/ci.in
typeguard==4.1.2
Expand Down
2 changes: 2 additions & 0 deletions requirements/ci.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ pytest
pytest-benchmark
pytest-socket
pytest-timeout
pytest-xdist
pytest-cov
# ruff # only take this for 3.11
typeguard
types-dataclasses
Expand Down
15 changes: 13 additions & 2 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ attrs==20.3.0
# flake8-bugbear
# flake8-implicit-str-concat
# pytest
coverage==6.2
# via -r requirements/ci.in
coverage[toml]==6.2
# via
# -r requirements/ci.in
# pytest-cov
execnet==1.9.0
# via pytest-xdist
flake8==5.0.4
# via
# -r requirements/ci.in
Expand Down Expand Up @@ -65,18 +69,25 @@ pytest==7.0.1
# via
# -r requirements/ci.in
# pytest-benchmark
# pytest-cov
# pytest-socket
# pytest-timeout
# pytest-xdist
pytest-benchmark==3.4.1
# via -r requirements/ci.in
pytest-cov==4.0.0
# via -r requirements/ci.in
pytest-socket==0.4.1
# via -r requirements/ci.in
pytest-timeout==2.1.0
# via -r requirements/ci.in
pytest-xdist==3.0.2
# via -r requirements/ci.in
six==1.16.0
# via flake8-print
tomli==1.2.3
# via
# coverage
# mypy
# pytest
typed-ast==1.5.5
Expand Down
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile requirements/dev.in
#
Expand Down

0 comments on commit 8aef1de

Please sign in to comment.