Skip to content

Commit c6293f9

Browse files
committed
Skip YAML-dependent tests when PyYAML is unavailable
1 parent c075ba3 commit c6293f9

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/test_qa.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
import unittest
44
from pathlib import Path
55

6+
try:
7+
import yaml as _yaml # noqa: F401
8+
except ModuleNotFoundError: # pragma: no cover
9+
_HAS_YAML = False
10+
else:
11+
_HAS_YAML = True
12+
613

714
class TestQAStatic(unittest.TestCase):
815
def test_contract_lint_requires_required_columns(self):
@@ -17,6 +24,7 @@ def test_contract_lint_requires_required_columns(self):
1724
# Minimal OK
1825
contract_lint({"required_columns": ["condition"]})
1926

27+
@unittest.skipUnless(_HAS_YAML, "pyyaml is not installed")
2028
def test_static_qa_reads_acceptance_from_config_qa(self):
2129
from psyflow.qa.static import static_qa
2230

tests/test_task_launcher.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
from unittest.mock import patch
66
import json
77

8+
try:
9+
import yaml as _yaml # noqa: F401
10+
except ModuleNotFoundError: # pragma: no cover
11+
_HAS_YAML = False
12+
else:
13+
_HAS_YAML = True
14+
815

916
class TestTaskLauncher(unittest.TestCase):
1017
def test_run_task_shortcut_directory_with_config_and_passthrough(self):
@@ -113,6 +120,7 @@ def test_readme_maturity_badge_handles_non_utf8_readme(self):
113120
out = readme.read_text(encoding="cp1252")
114121
self.assertIn("Maturity: piloted", out)
115122

123+
@unittest.skipUnless(_HAS_YAML, "pyyaml is not installed")
116124
def test_run_qa_shortcut_requires_acceptance_criteria(self):
117125
from psyflow.task_launcher import run_qa_shortcut
118126

0 commit comments

Comments
 (0)