diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-12 02:30:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 02:30:07 (GMT) |
commit | 936376916100681d46db117bae0ec05adf338051 (patch) | |
tree | 414c667a55da2e60367316bfd66da08f65c09ec9 /Lib/test | |
parent | f2a55fecd063244a5fd09a38f673f0781f8802d1 (diff) | |
download | cpython-936376916100681d46db117bae0ec05adf338051.zip cpython-936376916100681d46db117bae0ec05adf338051.tar.gz cpython-936376916100681d46db117bae0ec05adf338051.tar.bz2 |
gh-109295: Skip test_generated_cases if different mount drives (#109308)
On Windows, skip the test if the current working directory and the
Python source code directory have different mount drives. It happens
if the temporary directory is on a different mount drive than the
Python source code.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_generated_cases.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Lib/test/test_generated_cases.py b/Lib/test/test_generated_cases.py index be3dfd2..b5eaf82 100644 --- a/Lib/test/test_generated_cases.py +++ b/Lib/test/test_generated_cases.py @@ -1,11 +1,31 @@ import contextlib +import os +import sys import tempfile import unittest -import os from test import support from test import test_tools + +def skip_if_different_mount_drives(): + if sys.platform != 'win32': + return + ROOT = os.path.dirname(os.path.dirname(__file__)) + root_drive = os.path.splitroot(ROOT)[0] + cwd_drive = os.path.splitroot(os.getcwd())[0] + if root_drive != cwd_drive: + # generate_cases.py uses relpath() which raises ValueError if ROOT + # and the current working different have different mount drives + # (on Windows). + raise unittest.SkipTest( + f"the current working directory and the Python source code " + f"directory have different mount drives " + f"({cwd_drive} and {root_drive})" + ) +skip_if_different_mount_drives() + + test_tools.skip_if_missing('cases_generator') with test_tools.imports_under_tool('cases_generator'): import generate_cases |