Skip to content

bpo-47089: Avoid test_compileall failures on Windows #32037

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2022

Conversation

jkloth
Copy link
Contributor

@jkloth jkloth commented Mar 21, 2022

if not self._sys_path_writable:
raise unittest.SkipTest('not all entries on sys.path are writable')
@contextlib.contextmanager
def _use_pycache_prefix(self, basedir):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to a different name and omit the parameter which is always self.directory:

Suggested change
def _use_pycache_prefix(self, basedir):
def set_pycache_prefix(self):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was attempting to match the "style" of this file as best as possible. I have now renamed it to match the context manager used within test_importlib. Also, "set" doesn't feel right for use in a with statement. I guess it comes from English grammar of using present participle (-ing forms) after prepositions (with).

@@ -460,31 +460,18 @@ def test_error(self):
class CommandLineTestsBase:
"""Test compileall's CLI."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I reviewed this PR, I failed to find where self.directory comes from. Usually, the setUp() method is defined first in a test case. Would you move to move the setUp() of this class at the beginning? It would help to see where self.directory comes from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. The test suite as a whole is pretty much a free-for-all style-wise.

@vstinner vstinner added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes skip news labels Apr 1, 2022
@vstinner vstinner merged commit 76b8a07 into python:main Apr 1, 2022
@miss-islington
Copy link
Contributor

Thanks @jkloth for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @jkloth and @vstinner, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 76b8a075b8a79b08468fd0ed06a489a5c815bc11 3.9

@bedevere-bot
Copy link

GH-32237 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 1, 2022
(cherry picked from commit 76b8a07)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
@vstinner
Copy link
Member

vstinner commented Apr 1, 2022

Merged, thanks!

@jkloth: There are conflicts on backporting your fix to 3.9. Do you want to attempt backporting it manually?

jkloth added a commit to jkloth/cpython that referenced this pull request Apr 1, 2022
…32037).

(cherry picked from commit 76b8a07)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
@bedevere-bot
Copy link

GH-32240 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Apr 1, 2022
miss-islington added a commit that referenced this pull request Apr 1, 2022
(cherry picked from commit 76b8a07)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
vstinner pushed a commit that referenced this pull request Apr 2, 2022
GH-32240)

* [3.9] bpo-47089: Avoid test_compileall failures on Windows (GH-32037).
(cherry picked from commit 76b8a07)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
@jkloth jkloth deleted the issue47089 branch April 5, 2022 22:29
hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
…32037). (pythonGH-32240)

* [3.9] bpo-47089: Avoid test_compileall failures on Windows (pythonGH-32037).
(cherry picked from commit 76b8a07)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants