Skip to content

Commit

Permalink
👷‍♂️ Ensure the PYTHONPATH is set properly when testing the tutoria…
Browse files Browse the repository at this point in the history
…l scripts (#407)
  • Loading branch information
theMarix committed Nov 7, 2022
1 parent 29bec40 commit 52f488d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_tutorial/test_subcommands/test_tutorial001.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import subprocess

import pytest
Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions tests/test_tutorial/test_subcommands/test_tutorial003.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import subprocess

import pytest
Expand Down Expand Up @@ -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

0 comments on commit 52f488d

Please sign in to comment.