Skip to content

Commit

Permalink
tests: add no covers for windows
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Feb 17, 2024
1 parent df522b1 commit 62ab776
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions nox/popen.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def shutdown_process(
with contextlib.suppress(subprocess.TimeoutExpired):
return proc.communicate(timeout=terminate_timeout)

proc.kill()
proc.kill() # pragma: win32 no cover

return proc.communicate()
return proc.communicate() # pragma: win32 no cover


def decode_output(output: bytes) -> str:
Expand Down
10 changes: 5 additions & 5 deletions nox/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def _clean_location(self) -> bool:
def bin_paths(self) -> list[str]:
"""Returns the location of the conda env's bin folder."""
# see https://github.com/conda/conda/blob/f60f0f1643af04ed9a51da3dd4fa242de81e32f4/conda/activate.py#L563-L572
if _SYSTEM == "Windows":
if _SYSTEM == "Windows": # pragma: win32 cover
return [
self.location,
os.path.join(self.location, "Library", "mingw-w64", "bin"),
Expand All @@ -247,7 +247,7 @@ def bin_paths(self) -> list[str]:
os.path.join(self.location, "bin"),
]

return [os.path.join(self.location, "bin")]
return [os.path.join(self.location, "bin")] # pragma: win32 no cover

def create(self) -> bool:
"""Create the conda env."""
Expand Down Expand Up @@ -353,7 +353,7 @@ def _check_reused_environment_type(self) -> bool:
path = os.path.join(self.location, "pyvenv.cfg")
if not os.path.isfile(path):
# virtualenv < 20.0 does not create pyvenv.cfg
old_env = "virtualenv"
old_env = "virtualenv" # pragma: win32 no cover
else:
pattern = re.compile("virtualenv[ \t]*=")
with open(path) as fp:
Expand All @@ -373,7 +373,7 @@ def _check_reused_environment_interpreter(self) -> bool:
"import sys; sys.stdout.write(getattr(sys, 'real_prefix', sys.base_prefix))"
)

if original is None:
if original is None: # pragma: win32 no cover
output = nox.command.run(
[self._resolved_interpreter, "-c", program], silent=True, log=False
)
Expand All @@ -389,7 +389,7 @@ def _check_reused_environment_interpreter(self) -> bool:
def _read_base_prefix_from_pyvenv_cfg(self) -> str | None:
"""Return the base-prefix entry from pyvenv.cfg, if present."""
path = os.path.join(self.location, "pyvenv.cfg")
if os.path.isfile(path):
if os.path.isfile(path): # pragma: win32 no cover
with open(path) as io:
for line in io:
key, _, value = line.partition("=")
Expand Down

0 comments on commit 62ab776

Please sign in to comment.