Skip to content

bpo-47089: Avoid test_compileall failures on Windows#32037

Merged
vstinner merged 2 commits into
python:mainfrom
jkloth:issue47089
Apr 1, 2022
Merged

bpo-47089: Avoid test_compileall failures on Windows#32037
vstinner merged 2 commits into
python:mainfrom
jkloth:issue47089

Conversation

@jkloth

@jkloth jkloth commented Mar 21, 2022

Copy link
Copy Markdown
Contributor

Comment thread Lib/test/test_compileall.py Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@miss-islington

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

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

vstinner commented Apr 1, 2022

Copy link
Copy Markdown
Member

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

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

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