Skip to content

Commit 79c5f32

Browse files
authored
Merge pull request #37 from swansonk14/windows-tests
Fixed windows GitHub Actions tests tempfile issue
2 parents 76f8bc3 + 2a4cf68 commit 79c5f32

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

.github/workflows/tap-tests.yml renamed to .github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ jobs:
2424
uses: actions/setup-python@v2
2525
with:
2626
python-version: ${{ matrix.python-version }}
27+
- name: Set temp directories on Windows
28+
if: matrix.os == 'windows-latest'
29+
run: |
30+
echo "TMPDIR=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
31+
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
32+
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
2733
- name: Install dependencies
2834
run: |
2935
git config --global user.email "[email protected]"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea
2+
.vscode
23
__pycache__
34
.DS_Store
45
*.json

tests/test_utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,17 @@ def test_has_git_false(self) -> None:
5757
self.assertFalse(has_git())
5858
os.chdir(self.temp_dir.name)
5959

60-
# TODO: fix this test on Windows
61-
@unittest.skipIf(platform.system() == 'Windows', 'Inconsistent user path on Windows in GitHub Actions')
6260
def test_get_git_root(self) -> None:
6361
# Ideally should be self.temp_dir.name == get_git_root() but the OS may add a prefix like /private
64-
self.assertTrue(get_git_root().endswith(self.temp_dir.name))
62+
self.assertTrue(get_git_root().endswith(self.temp_dir.name.replace('\\', '/')))
6563

66-
# TODO: fix this test on Windows
67-
@unittest.skipIf(platform.system() == 'Windows', 'Inconsistent user path on Windows in GitHub Actions')
6864
def test_get_git_root_subdir(self) -> None:
6965
subdir = os.path.join(self.temp_dir.name, 'subdir')
7066
os.makedirs(subdir)
7167
os.chdir(subdir)
7268

7369
# Ideally should be self.temp_dir.name == get_git_root() but the OS may add a prefix like /private
74-
self.assertTrue(get_git_root().endswith(self.temp_dir.name))
70+
self.assertTrue(get_git_root().endswith(self.temp_dir.name.replace('\\', '/')))
7571

7672
os.chdir(self.temp_dir.name)
7773

0 commit comments

Comments
 (0)