Skip to content

Commit 4ddb0c3

Browse files
committed
Add Windows testing to CI
1 parent f54d29f commit 4ddb0c3

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
- ubuntu-latest
1515
python-version:
1616
["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", pypy3.9, pypy3.10]
17+
include:
18+
# Test lowest and highest Python versions on Windows
19+
- os: windows-latest
20+
python-version: "3.9"
21+
- os: windows-latest
22+
python-version: "3.14"
1723

1824
steps:
1925
- uses: actions/checkout@v6

tests/test_cli.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
from pathlib import Path
34
from typing import Optional
45

@@ -173,6 +174,9 @@ def test_set_no_file(cli):
173174
assert "Missing argument" in result.output
174175

175176

177+
@pytest.mark.skipif(
178+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
179+
)
176180
def test_get_default_path(tmp_path):
177181
with sh.pushd(tmp_path):
178182
(tmp_path / ".env").write_text("a=b")
@@ -182,6 +186,9 @@ def test_get_default_path(tmp_path):
182186
assert result == "b\n"
183187

184188

189+
@pytest.mark.skipif(
190+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
191+
)
185192
def test_run(tmp_path):
186193
with sh.pushd(tmp_path):
187194
(tmp_path / ".env").write_text("a=b")
@@ -191,6 +198,9 @@ def test_run(tmp_path):
191198
assert result == "b\n"
192199

193200

201+
@pytest.mark.skipif(
202+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
203+
)
194204
def test_run_with_existing_variable(tmp_path):
195205
with sh.pushd(tmp_path):
196206
(tmp_path / ".env").write_text("a=b")
@@ -202,6 +212,9 @@ def test_run_with_existing_variable(tmp_path):
202212
assert result == "b\n"
203213

204214

215+
@pytest.mark.skipif(
216+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
217+
)
205218
def test_run_with_existing_variable_not_overridden(tmp_path):
206219
with sh.pushd(tmp_path):
207220
(tmp_path / ".env").write_text("a=b")
@@ -213,6 +226,9 @@ def test_run_with_existing_variable_not_overridden(tmp_path):
213226
assert result == "c\n"
214227

215228

229+
@pytest.mark.skipif(
230+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
231+
)
216232
def test_run_with_none_value(tmp_path):
217233
with sh.pushd(tmp_path):
218234
(tmp_path / ".env").write_text("a=b\nc")
@@ -222,6 +238,9 @@ def test_run_with_none_value(tmp_path):
222238
assert result == "b\n"
223239

224240

241+
@pytest.mark.skipif(
242+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
243+
)
225244
def test_run_with_other_env(dotenv_path):
226245
dotenv_path.write_text("a=b")
227246

tests/test_main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@ def test_load_dotenv_file_stream(dotenv_path):
456456
assert os.environ == {"a": "b"}
457457

458458

459+
@pytest.mark.skipif(
460+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
461+
)
459462
def test_load_dotenv_in_current_dir(tmp_path):
460463
dotenv_path = tmp_path / ".env"
461464
dotenv_path.write_bytes(b"a=b")

tests/test_zip_imports.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from unittest import mock
66
from zipfile import ZipFile
77

8+
import pytest
89
import sh
910

1011

@@ -62,6 +63,9 @@ def test_load_dotenv_gracefully_handles_zip_imports_when_no_env_file(tmp_path):
6263
import child1.child2.test # noqa
6364

6465

66+
@pytest.mark.skipif(
67+
sys.platform.startswith("win"), reason="sh module doesn't support Windows"
68+
)
6569
def test_load_dotenv_outside_zip_file_when_called_in_zipfile(tmp_path):
6670
zip_file_path = setup_zipfile(
6771
tmp_path,

0 commit comments

Comments
 (0)