Skip to content

Commit 7f10fe4

Browse files
committed
gh-109295: Skip test_generated_cases if different mount drives
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.
1 parent 7dedfd3 commit 7f10fe4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Lib/test/test_generated_cases.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@
66
from test import support
77
from test import test_tools
88

9+
10+
def skip_if_different_mount_drives():
11+
if sys.platform != 'win32':
12+
return
13+
ROOT = os.path.dirname(os.path.dirname(__file__))
14+
root_drive = os.path.splitroot(ROOT)[0]
15+
cwd_drive = os.path.splitroot(os.getcwd())[0]
16+
if root_drive != cwd_drive:
17+
# generate_cases.py uses relpath() which raises ValueError if ROOT
18+
# and the current working different have different mount drives
19+
# (on Windows).
20+
raise unittest.SkipTest(
21+
f"the current working directory and the Python source code "
22+
f"directory have different mount drives "
23+
f"({cwd_drive} and {root_drive})"
24+
)
25+
skip_if_different_mount_drives()
26+
27+
928
test_tools.skip_if_missing('cases_generator')
1029
with test_tools.imports_under_tool('cases_generator'):
1130
import generate_cases

0 commit comments

Comments
 (0)