11import os
2+ import sys
23from pathlib import Path
34from typing import Optional
45
56import pytest
6- import sh
77
88import dotenv
99from dotenv .cli import cli as dotenv_cli
1010from dotenv .version import __version__
1111
12+ if not sys .platform .startswith ("win" ):
13+ import sh
14+
1215
1316@pytest .mark .parametrize (
1417 "output_format,content,expected" ,
@@ -173,6 +176,9 @@ def test_set_no_file(cli):
173176 assert "Missing argument" in result .output
174177
175178
179+ @pytest .mark .skipif (
180+ sys .platform .startswith ("win" ), reason = "sh module doesn't support Windows"
181+ )
176182def test_get_default_path (tmp_path ):
177183 with sh .pushd (tmp_path ):
178184 (tmp_path / ".env" ).write_text ("a=b" )
@@ -182,6 +188,9 @@ def test_get_default_path(tmp_path):
182188 assert result == "b\n "
183189
184190
191+ @pytest .mark .skipif (
192+ sys .platform .startswith ("win" ), reason = "sh module doesn't support Windows"
193+ )
185194def test_run (tmp_path ):
186195 with sh .pushd (tmp_path ):
187196 (tmp_path / ".env" ).write_text ("a=b" )
@@ -191,6 +200,9 @@ def test_run(tmp_path):
191200 assert result == "b\n "
192201
193202
203+ @pytest .mark .skipif (
204+ sys .platform .startswith ("win" ), reason = "sh module doesn't support Windows"
205+ )
194206def test_run_with_existing_variable (tmp_path ):
195207 with sh .pushd (tmp_path ):
196208 (tmp_path / ".env" ).write_text ("a=b" )
@@ -202,6 +214,9 @@ def test_run_with_existing_variable(tmp_path):
202214 assert result == "b\n "
203215
204216
217+ @pytest .mark .skipif (
218+ sys .platform .startswith ("win" ), reason = "sh module doesn't support Windows"
219+ )
205220def test_run_with_existing_variable_not_overridden (tmp_path ):
206221 with sh .pushd (tmp_path ):
207222 (tmp_path / ".env" ).write_text ("a=b" )
@@ -213,6 +228,9 @@ def test_run_with_existing_variable_not_overridden(tmp_path):
213228 assert result == "c\n "
214229
215230
231+ @pytest .mark .skipif (
232+ sys .platform .startswith ("win" ), reason = "sh module doesn't support Windows"
233+ )
216234def test_run_with_none_value (tmp_path ):
217235 with sh .pushd (tmp_path ):
218236 (tmp_path / ".env" ).write_text ("a=b\n c" )
@@ -222,6 +240,9 @@ def test_run_with_none_value(tmp_path):
222240 assert result == "b\n "
223241
224242
243+ @pytest .mark .skipif (
244+ sys .platform .startswith ("win" ), reason = "sh module doesn't support Windows"
245+ )
225246def test_run_with_other_env (dotenv_path ):
226247 dotenv_path .write_text ("a=b" )
227248
0 commit comments