Skip to content

Commit 7e52126

Browse files
carmoccalexierule
authored andcommitted
Fix standalone test collection (#13177)
1 parent e21219d commit 7e52126

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/standalone_tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ files=$(echo "$grep_output" | cut -f1 -d: | sort | uniq)
2828
# get the list of parametrizations. we need to call them separately. the last two lines are removed.
2929
# note: if there's a syntax error, this will fail with some garbled output
3030
if [[ "$OSTYPE" == "darwin"* ]]; then
31-
parametrizations=$(pytest $files --collect-only --quiet "$@" | tail -r | sed -e '1,3d' | tail -r)
31+
parametrizations=$(python -m pytest $files --collect-only --quiet "$@" | tail -r | sed -e '1,3d' | tail -r)
3232
else
33-
parametrizations=$(pytest $files --collect-only --quiet "$@" | head -n -2)
33+
parametrizations=$(python -m pytest $files --collect-only --quiet "$@" | head -n -2)
3434
fi
3535
parametrizations_arr=($parametrizations)
3636

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

4141
for i in "${!parametrizations_arr[@]}"; do

tests/utilities/test_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from pytorch_lightning.utilities.warnings import WarningCache
2424

2525
standalone = os.getenv("PL_RUN_STANDALONE_TESTS", "0") == "1"
26-
if standalone:
26+
if standalone and __name__ == "__main__":
2727

2828
stderr = StringIO()
2929
# recording

0 commit comments

Comments
 (0)