Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-109295: Skip test_generated_cases if different mount drives#109308

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 1 commit intopython:mainfromvstinner:test_generated_cases
Sep 12, 2023

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commentedSep 12, 2023
edited by bedevere-appbot
Loading

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.

On Windows, skip the test if the current working directory and thePython source code directory have different mount drives. It happensif the temporary directory is on a different mount drive than thePython source code.
@vstinner
Copy link
MemberAuthor

Example without the fix:

vstinner@WIN C:\victor\python\main>cdC:\victor\python\mainvstinner@WIN C:\victor\python\main>python -m test test_generated_cases --tempdir=E:\TEMP\ -j1Running Debug|x64 interpreter...0:00:00 Run tests in parallel using 1 child processes0:00:00 [1/1/1] test_generated_cases failed (uncaught exception)test test_generated_cases crashed -- Traceback (most recent call last):  (...)  File "C:\victor\python\main\Lib\test\test_generated_cases.py", line 11, in <module>    import generate_cases  File "C:\victor\python\main\Tools\cases_generator\generate_cases.py", line 41, in <module>    DEFAULT_INPUT = os.path.relpath(os.path.join(ROOT, "Python/bytecodes.c"))                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\victor\python\main\Lib\ntpath.py", line 791, in relpath    raise ValueError("path is on mount %r, start on mount %r" % (ValueError: path is on mount 'C:', start on mount 'E:'== Tests result: FAILURE ==1 test failed:    test_generated_casesTotal duration: 793 msTotal tests: run=0Total test files: run=1/1 failed=1Result: FAILURE

With the fix:

vstinner@WIN C:\victor\python\main>cdC:\victor\python\mainvstinner@WIN C:\victor\python\main>python -m test test_generated_cases --tempdir=E:\TEMP\ -j1Running Debug|x64 interpreter...0:00:00 Run tests in parallel using 1 child processes0:00:00 [1/1] test_generated_cases skippedtest_generated_cases skipped -- the current working directory and the Python source code directory have different mount drives (E: and C:)== Tests result: SUCCESS ==1 test skipped:    test_generated_casesTotal duration: 613 msTotal tests: run=0Total test files: run=1/1 skipped=1Result: SUCCESS

@vstinnervstinner merged commit9363769 intopython:mainSep 12, 2023
@vstinnervstinner deleted the test_generated_cases branchSeptember 12, 2023 02:30
@vstinnervstinner added needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsSep 12, 2023
@miss-islington
Copy link
Contributor

Thanks@vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks@vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

Sorry,@vstinner, I could not cleanly backport this to3.11 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker 936376916100681d46db117bae0ec05adf338051 3.11

@miss-islington
Copy link
Contributor

Sorry,@vstinner, I could not cleanly backport this to3.12 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker 936376916100681d46db117bae0ec05adf338051 3.12

@vstinnervstinner removed needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsSep 12, 2023
@vstinner
Copy link
MemberAuthor

Python 3.11 and 3.12 are not affected:Lib/test/test_generated_cases.py is new in Python 3.13.

@vstinner
Copy link
MemberAuthor

An alternative would be to change the current working directory while testing test_generated_cases, as done by test_pyexpat:#109233

But the problem is that the directory should be changed early when test_generated_cases.py is imported, before the first Tools/cases_generator/ import, and the old directory should be restore "later". But when is "later"? After the import? And then change again cwd while running tests using setUpModule()/tearDownModule()?

Well, for me it was too complicated, and I made the minimum fix: just skip the test.

vstinner added a commit to vstinner/cpython that referenced this pull requestSep 13, 2023
…ython#109308)On Windows, skip the test if the current working directory and thePython source code directory have different mount drives. It happensif the temporary directory is on a different mount drive than thePython source code.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@vstinnervstinner

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@vstinner@miss-islington

[8]ページ先頭

©2009-2025 Movatter.jp