Skip to content

Commit dd9b001

Browse files
committed
feat(tests): add pytest-order and enhance error logging in command execution
1 parent 5d13647 commit dd9b001

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

plugins/tutor-contrib-paragon/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies = [
3030
"tutor>=19.0.0,<20.0.0",
3131
]
3232

33-
optional-dependencies = { dev = ["tutor[dev]>=19.0.0,<20.0.0", "pytest>=8.3.4"] }
33+
optional-dependencies = { dev = ["tutor[dev]>=19.0.0,<20.0.0", "pytest>=8.3.4", "pytest-order>=1.3.0"] }
3434

3535
# These fields will be set by hatch_build.py
3636
dynamic = ["version"]

plugins/tutor-contrib-paragon/tests/integration/helpers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,19 @@ def execute_tutor_command(command: list[str]):
2121
Returns:
2222
subprocess.CompletedProcess: Contains stdout, stderr, returncode.
2323
"""
24+
full_command = ["tutor"] + command
2425
result = subprocess.run(
25-
["tutor"] + command,
26+
full_command,
2627
stdout=subprocess.PIPE,
2728
stderr=subprocess.PIPE,
2829
text=True,
2930
check=False,
3031
)
3132

33+
if result.returncode != 0:
34+
logger.error("Command failed: %s", " ".join(full_command))
35+
logger.error("stderr: %s", result.stderr.strip())
36+
3237
return result
3338

3439

plugins/tutor-contrib-paragon/tests/integration/plugin_setup_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
PARAGON_THEME_SOURCES_FOLDER,
1616
)
1717

18+
import pytest
1819
import logging
1920
import os
2021

2122
logger = logging.getLogger(__name__)
2223

2324

25+
@pytest.mark.order(1)
2426
def test_paragon_plugin_installed():
2527
"""Verify that the 'paragon' plugin is installed and enabled."""
2628

@@ -34,6 +36,7 @@ def test_paragon_plugin_installed():
3436
assert "enabled" in result.stdout, f"The '{PARAGON_NAME}' plugin is not enabled"
3537

3638

39+
@pytest.mark.order(2)
3740
def test_paragon_plugin_folders_created():
3841
"""Verify that the 'paragon' plugin's folders exist in the filesystem."""
3942

@@ -51,6 +54,7 @@ def test_paragon_plugin_folders_created():
5154
assert os.path.isdir(folder_path), f"{folder_path} is not a directory."
5255

5356

57+
@pytest.mark.order(3)
5458
def test_paragon_plugin_build_tokens_job_exists():
5559
"""Verify that the 'paragon-build-tokens' job exists in Tutor's configuration."""
5660

0 commit comments

Comments
 (0)