Skip to content

Commit 9e195cf

Browse files
committed
Use pytest-xdist
pytest is slow in serial. Use xdist to speed things up. ~90+ seconds run -> ~20seconds with xdist
1 parent 3a7f7d3 commit 9e195cf

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ test = [
2626
'pytest-cov',
2727
'pytest',
2828
'pytest-asyncio',
29+
'pytest-xdist',
2930
'tqdm',
3031
]
3132

script/test.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ test_go() {
1919
}
2020

2121
test_python() {
22-
.venv/bin/pytest "$@" -vv
22+
# Only add -n auto if -n isn't already specified (supports -n <digits> or -n auto)
23+
if [[ ! "$*" =~ -n[[:space:]]*([[:digit:]]+|auto) ]]; then
24+
.venv/bin/pytest "$@" -vv -n auto
25+
else
26+
.venv/bin/pytest "$@" -vv
27+
fi
2328
}
2429

2530
if [ $# -eq 0 ]; then

0 commit comments

Comments
 (0)