Skip to content

Commit e033d1d

Browse files
committed
try.
1 parent 1745016 commit e033d1d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ class Result(NamedTuple):
121121
stderr: str
122122

123123

124-
def run_in_subprocess(cmd: tuple[str, ...], cwd: Path | None = None) -> Result:
124+
def run_in_subprocess(
125+
cmd: tuple[str, ...], cwd: Path | None = None, env: dict[str, str] | None = None
126+
) -> Result:
125127
"""Run a command in a subprocess and return the output."""
126-
result = subprocess.run(cmd, cwd=cwd, check=False, capture_output=True)
128+
result = subprocess.run(cmd, cwd=cwd, check=False, capture_output=True, env=env)
127129
return Result(
128130
exit_code=result.returncode,
129131
stdout=result.stdout.decode("utf-8", "replace").replace("\r\n", "\n"),

tests/test_hook_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def pytask_extend_command_line_interface(cli):
5252
else:
5353
args = ("pytask", "build", "--hook-module", "hooks/hooks.py", "--help")
5454

55-
result = run_in_subprocess(args, cwd=tmp_path)
55+
result = run_in_subprocess(args, cwd=tmp_path, env={"NO_COLOR": "1"})
5656
assert result.exit_code == ExitCode.OK
5757
assert "--new-option" in result.stdout
5858

0 commit comments

Comments
 (0)