Skip to content

Commit

Permalink
define pytest cachedir
Browse files Browse the repository at this point in the history
stops test runs from interacting when using --last-failed with pytest
  • Loading branch information
leej3 committed Apr 24, 2024
1 parent 9a6e282 commit 52d8770
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/run_cpu_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ fi
MATCH_TESTS_EXPRESSION=${1:-""}

# Catch exit code 5 when tests are deselected from previous passing run
CUDA_VISIBLE_DEVICES="" pytest ${EXTRA_PYTEST_ARGS:-} --tx 4*popen//python=python --cov ignite --cov-report term-missing --cov-report xml -vvv tests "${skip_distrib_opt[@]}" -k "$MATCH_TESTS_EXPRESSION" || { exit_code=$?; if [ "$exit_code" -eq 5 ]; then echo "All tests deselected"; else exit $exit_code; fi;}
CUDA_VISIBLE_DEVICES="" pytest ${EXTRA_PYTEST_ARGS:-} --cache-dir .cpu-not-distrib --tx 4*popen//python=python --cov ignite --cov-report term-missing --cov-report xml -vvv tests "${skip_distrib_opt[@]}" -k "$MATCH_TESTS_EXPRESSION" || { exit_code=$?; if [ "$exit_code" -eq 5 ]; then echo "All tests deselected"; else exit $exit_code; fi;}

# https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02
if [ "${SKIP_DISTRIB_TESTS:-0}" -eq "1" ]; then
exit 0
fi

export WORLD_SIZE=2
CUDA_VISIBLE_DEVICES="" pytest ${EXTRA_PYTEST_ARGS:-} --cov ignite --cov-append --cov-report term-missing --cov-report xml --dist=each --tx $WORLD_SIZE*popen//python=python tests -m distributed -vvv -k "$MATCH_TESTS_EXPRESSION"
CUDA_VISIBLE_DEVICES="" pytest ${EXTRA_PYTEST_ARGS:-} --cache-dir .cpu-distrib --cov ignite --cov-append --cov-report term-missing --cov-report xml --dist=each --tx $WORLD_SIZE*popen//python=python tests -m distributed -vvv -k "$MATCH_TESTS_EXPRESSION"
unset WORLD_SIZE
7 changes: 4 additions & 3 deletions tests/run_gpu_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ fi

set -xeu
# Catch exit code 5 when tests are deselected from previous passing run
pytest ${EXTRA_PYTEST_ARGS:-} --cov ignite --cov-report term-missing --cov-report xml -vvv tests/ -k "$cuda_pattern" || { exit_code=$?; if [ "$exit_code" -eq 5 ]; then echo "All tests deselected"; else exit $exit_code; fi;}
pytest ${EXTRA_PYTEST_ARGS:-} --cache-dir .gpu-cuda --cov ignite --cov-report term-missing --cov-report xml -vvv tests/ -k "$cuda_pattern" || { exit_code=$?; if [ "$exit_code" -eq 5 ]; then echo "All tests deselected"; else exit $exit_code; fi;}


# https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02
if [ "${SKIP_DISTRIB_TESTS:-0}" -eq "1" ]; then
exit 0
fi

pytest ${EXTRA_PYTEST_ARGS:-} --cov ignite --cov-append --cov-report term-missing --cov-report xml -vvv tests/ -m distributed -k "$MATCH_TESTS_EXPRESSION"
pytest ${EXTRA_PYTEST_ARGS:-} --cache-dir .gpu-distrib --cov ignite --cov-append --cov-report term-missing --cov-report xml -vvv tests/ -m distributed -k "$MATCH_TESTS_EXPRESSION"


if [ ${ngpus} -gt 1 ]; then

export WORLD_SIZE=${ngpus}
pytest ${EXTRA_PYTEST_ARGS:-} --cov ignite --cov-append --cov-report term-missing --cov-report xml --dist=each --tx ${WORLD_SIZE}*popen//python=python tests -m distributed -vvv -k "$MATCH_TESTS_EXPRESSION"
pytest ${EXTRA_PYTEST_ARGS:-} --cache-dir .gpu-distrib-multi --cov ignite --cov-append --cov-report term-missing --cov-report xml --dist=each --tx ${WORLD_SIZE}*popen//python=python tests -m distributed -vvv -k "$MATCH_TESTS_EXPRESSION"
unset WORLD_SIZE

fi
2 changes: 1 addition & 1 deletion tests/run_tpu_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pytest ${EXTRA_PYTEST_ARGS:-} --cov ignite --cov-report term-missing --cov-repor

if [ -z ${NUM_TPU_WORKERS+x} ]; then
export NUM_TPU_WORKERS=1
pytest ${EXTRA_PYTEST_ARGS:-} --cov ignite --cov-append --cov-report term-missing --cov-report xml tests/ -vvv -m tpu
pytest ${EXTRA_PYTEST_ARGS:-} --cache-dir .tpu-multi --cov ignite --cov-append --cov-report term-missing --cov-report xml tests/ -vvv -m tpu
fi

0 comments on commit 52d8770

Please sign in to comment.