Skip to content

Commit b8a4305

Browse files
authored
ci: Adds pytest-xdist auto (#429)
* ci: Adds pytest-xdist auto * Fix race condition test_job_listing_and_retrieval * Updates README.md
1 parent 779ea20 commit b8a4305

File tree

5 files changed

+42
-3
lines changed

5 files changed

+42
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
mkdir test_results
6161
set -e
6262
TEST_FILES=$(circleci tests glob "tests/**/test_*.py")
63-
echo "$TEST_FILES" | circleci tests run --command "xargs poetry run coverage run --include=nucleus/* -m pytest -s -v -o junit_family=legacy --junitxml=test_results/junit.xml" --verbose --split-by=timings
63+
echo "$TEST_FILES" | circleci tests run --command "xargs poetry run coverage run --include=nucleus/* -m pytest -n auto -s -v -o junit_family=legacy --junitxml=test_results/junit.xml" --verbose --split-by=timings
6464
poetry run coverage report
6565
poetry run coverage html
6666
- store_test_results:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ poetry run pytest tests/test_dataset.py
8585
(2) To skip slow integration tests that have to wait for an async job to start.
8686

8787
```
88-
poetry run pytest -m "not integration"
88+
poetry run pytest -n auto -m "not integration"
8989
```
90+
Note: "-n auto" is used for pytest-xdist parallelization
9091

9192
## Pydantic Models
9293

poetry.lock

Lines changed: 36 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ ruff = "^0.0.290"
8787
types-setuptools = "^68.2.0.0"
8888
types-requests = "^2.31.0.2"
8989
types-python-dateutil = "^2.8.19.14"
90+
pytest-xdist = "^3.5.0"
9091

9192
[tool.pytest.ini_options]
9293
markers = [

tests/test_jobs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ def test_job_listing_and_retrieval(CLIENT):
2828
assert len(jobs) > 0, "No jobs found"
2929
fetch_id = jobs[0].job_id
3030
fetched_job = CLIENT.get_job(fetch_id)
31+
# job_last_known_status can change
32+
fetched_job.job_last_known_status = jobs[0].job_last_known_status
3133
assert fetched_job == jobs[0]

0 commit comments

Comments
 (0)