Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selection of standalone tests #10857

Merged
merged 4 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .azure-pipelines/gpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@ jobs:
ls -l legacy/checkpoints/
displayName: 'Get legacy checkpoints'

- bash: |
python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests --ignore tests/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
displayName: 'Testing: standard'


- bash: |
bash tests/standalone_tests.sh
env:
PL_USE_MOCKED_MNIST: "1"
displayName: 'Testing: standalone'

- bash: |
python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests --ignore tests/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
displayName: 'Testing: standard'

- bash: |
python -m coverage report
python -m coverage xml
Expand Down
12 changes: 2 additions & 10 deletions tests/standalone_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ files=$(echo "$grep_output" | cut -f1 -d: | sort | uniq)
# get the list of parametrizations. we need to call them separately. the last two lines are removed.
# note: if there's a syntax error, this will fail with some garbled output
if [[ "$OSTYPE" == "darwin"* ]]; then
parametrizations=$(pytest $files --collect-only --quiet | tail -r | sed -e '1,3d' | tail -r)
parametrizations=$(pytest $files --collect-only --quiet "$@" | tail -r | sed -e '1,3d' | tail -r)
else
parametrizations=$(pytest $files --collect-only --quiet | head -n -2)
parametrizations=$(pytest $files --collect-only --quiet "$@" | head -n -2)
carmocca marked this conversation as resolved.
Show resolved Hide resolved
fi
parametrizations_arr=($parametrizations)

Expand All @@ -47,14 +47,6 @@ for i in "${!parametrizations_arr[@]}"; do
continue
fi

# STANDALONE_PATTERN allows filtering the tests to run when debugging.
# use as `STANDALONE_PATTERN="foo_bar" ./standalone_tests.sh` to run only those
# test with `foo_bar` in their name
if [[ $parametrization != *STANDALONE_PATTERN* ]]; then
report+="Skipped\t$parametrization\n"
continue
fi

# run the test
echo "Running ${parametrization}"
python ${defaults} "${parametrization}"
Expand Down