bpo-47089: Avoid test_compileall failures on Windows#32037
Conversation
| 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): |
There was a problem hiding this comment.
I suggest to a different name and omit the parameter which is always self.directory:
| def _use_pycache_prefix(self, basedir): | |
| def set_pycache_prefix(self): |
There was a problem hiding this comment.
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.""" | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Sure. The test suite as a whole is pretty much a free-for-all style-wise.
|
Sorry, @jkloth and @vstinner, I could not cleanly backport this to |
|
GH-32237 is a backport of this pull request to the 3.10 branch. |
(cherry picked from commit 76b8a07) Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
|
Merged, thanks! @jkloth: There are conflicts on backporting your fix to 3.9. Do you want to attempt backporting it manually? |
|
GH-32240 is a backport of this pull request to the 3.9 branch. |
…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>
https://bugs.python.org/issue47089