GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-109295: Skip test_generated_cases if different mount drives by vstinner · Pull Request #109308 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Sep 12, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

  • Issue: test_asyncio and test_compileall leak temporary files/directories #109295

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner vstinner added the skip news label Sep 12, 2023
@bedevere-app bedevere-app Bot added awaiting review tests Tests in the Lib/test dir labels Sep 12, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Sep 12, 2023
test_asyncio and test_compileall leak temporary files/directories #109295
Closed
@vstinner
pythongh-109295: Skip test_generated_cases if different mount drives
4ad15ef
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.
@vstinner
vstinner force-pushed the test_generated_cases branch from 7f10fe4 to 4ad15ef Compare September 12, 2023 01:58
@vstinner

vstinner commented Sep 12, 2023

Copy link
Copy Markdown
Member Author

Example without the fix:

vstinner@WIN C:\victor\python\main>cd
C:\victor\python\main

vstinner@WIN C:\victor\python\main>python -m test test_generated_cases --tempdir=E:\TEMP\ -j1
Running Debug|x64 interpreter...
0:00:00 Run tests in parallel using 1 child processes
0: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_cases

Total duration: 793 ms
Total tests: run=0
Total test files: run=1/1 failed=1
Result: FAILURE

With the fix:

vstinner@WIN C:\victor\python\main>cd
C:\victor\python\main

vstinner@WIN C:\victor\python\main>python -m test test_generated_cases --tempdir=E:\TEMP\ -j1
Running Debug|x64 interpreter...
0:00:00 Run tests in parallel using 1 child processes
0:00:00 [1/1] test_generated_cases skipped
test_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_cases

Total duration: 613 ms
Total tests: run=0
Total test files: run=1/1 skipped=1
Result: SUCCESS
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner merged commit 9363769 into python:main Sep 12, 2023
@vstinner
vstinner deleted the test_generated_cases branch September 12, 2023 02:30
@bedevere-app bedevere-app Bot removed the awaiting review label Sep 12, 2023
@vstinner vstinner added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Sep 12, 2023
@miss-islington

miss-islington commented Sep 12, 2023

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington

miss-islington commented Sep 12, 2023

Copy link
Copy Markdown
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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington

miss-islington commented Sep 12, 2023

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington miss-islington assigned vstinner Sep 12, 2023
@miss-islington

miss-islington commented Sep 12, 2023

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner removed needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Sep 12, 2023
@vstinner

vstinner commented Sep 12, 2023

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 12, 2023

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner added a commit to vstinner/cpython that referenced this pull request Sep 13, 2023
@vstinner
pythongh-109295: Skip test_generated_cases if different mount drives (p…
aea41fd
…ython#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@vstinner vstinner

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@vstinner @miss-islington
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.