diff --git a/tests/test_tutorial/test_subcommands/test_tutorial001.py b/tests/test_tutorial/test_subcommands/test_tutorial001.py index 5e1d1b4..b8da25e 100644 --- a/tests/test_tutorial/test_subcommands/test_tutorial001.py +++ b/tests/test_tutorial/test_subcommands/test_tutorial001.py @@ -1,3 +1,4 @@ +import os import subprocess import pytest @@ -84,11 +85,15 @@ def test_users_delete(app): def test_scripts(mod): from docs_src.subcommands.tutorial001 import items, users + env = os.environ.copy() + env["PYTHONPATH"] = ":".join(list(tutorial001.__path__)) + for module in [mod, items, users]: result = subprocess.run( ["coverage", "run", module.__file__, "--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", + env=env, ) assert "Usage" in result.stdout diff --git a/tests/test_tutorial/test_subcommands/test_tutorial003.py b/tests/test_tutorial/test_subcommands/test_tutorial003.py index 770da97..1edf8c1 100644 --- a/tests/test_tutorial/test_subcommands/test_tutorial003.py +++ b/tests/test_tutorial/test_subcommands/test_tutorial003.py @@ -1,3 +1,4 @@ +import os import subprocess import pytest @@ -157,11 +158,15 @@ def test_lands_towns_burn(app): def test_scripts(mod): from docs_src.subcommands.tutorial003 import items, lands, reigns, towns, users + env = os.environ.copy() + env["PYTHONPATH"] = ":".join(list(tutorial003.__path__)) + for module in [mod, items, lands, reigns, towns, users]: result = subprocess.run( ["coverage", "run", module.__file__, "--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", + env=env, ) assert "Usage" in result.stdout