Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/test_tutorial/test_subcommands/test_tutorial001.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ def test_scripts(mod):
from docs_src.subcommands.tutorial001_py310 import items, users

env = os.environ.copy()
env["PYTHONPATH"] = ":".join(list(tutorial001_py310.__path__))
env["PYTHONPATH"] = ":".join(
list(tutorial001_py310.__path__)
+ ([env["PYTHONPATH"]] if "PYTHONPATH" in env else [])
)

for module in [mod, items, users]:
result = subprocess.run(
Expand Down
5 changes: 4 additions & 1 deletion tests/test_tutorial/test_subcommands/test_tutorial003.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ def test_scripts(mod):
)

env = os.environ.copy()
env["PYTHONPATH"] = ":".join(list(tutorial003_py310.__path__))
env["PYTHONPATH"] = ":".join(
list(tutorial003_py310.__path__)
+ ([env["PYTHONPATH"]] if "PYTHONPATH" in env else [])
)

for module in [mod, items, lands, reigns, towns, users]:
result = subprocess.run(
Expand Down
14 changes: 14 additions & 0 deletions tests/test_types_file.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import subprocess
import sys
from io import BytesIO, StringIO
Expand All @@ -9,6 +10,7 @@
from typer._click.utils import PacifyFlushWrapper
from typer.testing import CliRunner

import tests
from tests.utils import needs_linux, needs_windows

app = typer.Typer()
Expand Down Expand Up @@ -136,6 +138,17 @@ def test_binary_dash() -> None:


def test_binary_stderr() -> None:
env = os.environ.copy()
env.update(
{
"PYTHONPATH": ":".join(
[str(Path(tests.__path__[0]).parent)] + [env["PYTHONPATH"]]
)
}
if "PYTHONPATH" in env
else {}
)

Comment thread
theMarix marked this conversation as resolved.
result = subprocess.run(
[
sys.executable,
Expand All @@ -146,6 +159,7 @@ def test_binary_stderr() -> None:
"write-binary-stderr",
],
capture_output=True,
env=env,
Comment thread
theMarix marked this conversation as resolved.
)
assert result.returncode == 0
assert result.stderr == b"binary-stderr\n"
Expand Down
Loading