Skip to content

Commit

Permalink
[CI]: fix wrong path on windows runners
Browse files Browse the repository at this point in the history
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
  • Loading branch information
antonag32 authored and moylop260 committed Jan 22, 2024
1 parent 1eb947e commit 0230ac2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_pre_commit_vauxoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
os.chdir(self.tmp_dir)
self.runner = CliRunner()
src_path = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "resources")
Expand Down

0 comments on commit 0230ac2

Please sign in to comment.