Skip to content

Commit

Permalink
Fix standalone test collection (#13177)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca committed May 31, 2022
1 parent 46b9dbe commit 9c6ee04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/standalone_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ 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=$(python -m pytest $files --collect-only --quiet "$@" | tail -r | sed -e '1,3d' | tail -r)
else
parametrizations=$(pytest $files --collect-only --quiet "$@" | head -n -2)
parametrizations=$(python -m pytest $files --collect-only --quiet "$@" | head -n -2)
fi
parametrizations_arr=($parametrizations)

# tests to skip - space separated
blocklist='tests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx'
blocklist='tests/profiler/test_profiler.py::test_pytorch_profiler_nested_emit_nvtx tests/utilities/test_warnings.py'
report=''

for i in "${!parametrizations_arr[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion tests/utilities/test_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pytorch_lightning.utilities.warnings import WarningCache

standalone = os.getenv("PL_RUN_STANDALONE_TESTS", "0") == "1"
if standalone:
if standalone and __name__ == "__main__":

stderr = StringIO()
# recording
Expand Down

0 comments on commit 9c6ee04

Please sign in to comment.