-
Notifications
You must be signed in to change notification settings - Fork 2
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
[IMP] cfg: update black version #129
Conversation
2a784f5
to
981a8de
Compare
14f7767
to
46032b4
Compare
It seems like there is a problem with tmpdir generation on windows. It generates them under a different user. This stack overflow seems related: https://stackoverflow.com/questions/51129686/gettemppatha-returning-incorrect-user-folder |
46032b4
to
b3c8d6b
Compare
This hack confirms it: diff --git a/tests/test_pre_commit_vauxoo.py b/tests/test_pre_commit_vauxoo.py
index e284313..060d1b2 100644
--- a/tests/test_pre_commit_vauxoo.py
+++ b/tests/test_pre_commit_vauxoo.py
@@ -2,6 +2,7 @@ from __future__ import annotations
import logging
import os
+import platform
import posixpath
import re
import shutil
@@ -27,6 +28,11 @@ class TestPreCommitVauxoo(unittest.TestCase):
self.old_environ = os.environ.copy()
self.original_work_dir = os.getcwd()
self.tmp_dir = tempfile.mkdtemp(suffix="_pre_commit_vauxoo")
+ if platform.system() == "Windows":
+ print("TMP DIR BEFORE HACK %s" % self.tmp_dir)
+ self.tmp_dir = self.tmp_dir.replace("RUNNER~1", "runneradmin")
+ print("TMP DIR AFTER HACK %s" % self.tmp_dir)
+
os.chdir(self.tmp_dir)
self.runner = CliRunner()
src_path = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "resources") |
Marked as draft until non-hacky fix is found. |
076f076
to
8f9f4ec
Compare
@@ -26,7 +26,7 @@ def setUp(self): | |||
super().setUp() | |||
self.old_environ = os.environ.copy() | |||
self.original_work_dir = os.getcwd() | |||
self.tmp_dir = tempfile.mkdtemp(suffix="_pre_commit_vauxoo") | |||
self.tmp_dir = os.path.realpath(tempfile.mkdtemp(suffix="_pre_commit_vauxoo")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you perform this on a separate commit, please?
Because it's not strictly related and to explain in commit message why it's necessary.
Black has been updated to its latest version. Biggest change involves black removing whitespaces after class/method declarations. BREAKING CHANGE: black may generate diffs on projects
Tests were updated to prevent edge cases where mkdtemp() returns "short" DOS paths on Windows, which cause errors like the following: File "src\black\__init__.py", line 616, in main File "src\black\__init__.py", line 703, in get_sources File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\pathlib.py", line 908, in relative_to raise ValueError("{!r} does not start with {!r}" ValueError: 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpc6klofvk_pre_commit_vauxoo\\module_autofix1\\__init__.py' does not start with 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\tmpc6klofvk_pre_commit_vauxoo
8f9f4ec
to
32ac481
Compare
Autofix hooks have been updated to their latest version. Biggest change involves black removing whitespaces after class/method declarations.
BREAKING CHANGE: black may generate diffs on projects