Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷‍♂️ Ensure the PYTHONPATH is set properly when testing the tutorial scripts #407

Merged
Merged
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: 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