tests: Improve unit tests runtime performance
This patch set does 2 things: 1) Improves unit test runtime peformance via pytest-xdist [0] 2) Reduces finnicky nature of `is_connected` helpers which sometimes skip even when there is access to the internet; logic has been added to make these checks more accurate to avoid skipping tests Note that while there are newer alternatives to pytest-xdist they are only compatible with much newer versions of Python. [0] https://pypi.org/project/pytest-xdist/ Change-Id: Ib04b48ebabca0551058e5e1065056f4e559fbfe6
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
|
||||
set -e
|
||||
posargs=$@
|
||||
# cross-platform way to derive the number of logical cores
|
||||
readonly num_cores=$(python -c 'import multiprocessing as mp; print(mp.cpu_count())')
|
||||
if [ ${#posargs} -ge 1 ]; then
|
||||
pytest -k ${posargs}
|
||||
pytest -k ${posargs} -n $num_cores
|
||||
else
|
||||
pytest
|
||||
pytest -n $num_cores
|
||||
fi
|
||||
set +e
|
||||
|
||||
Reference in New Issue
Block a user