👷♂️ Ensure the PYTHONPATH
is set properly when testing the tutorial scripts (#407)
This commit is contained in:
parent
29bec40e89
commit
52f488d1b0
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue