|
17 | 17 |
|
18 | 18 | import pytest |
19 | 19 |
|
20 | | -from wizards_consolidated.software.tech_debt_wizard import ( |
21 | | - DebtItem, |
22 | | - DebtSnapshot, |
23 | | - DebtTrajectory, |
24 | | - TechDebtWizard, |
25 | | -) |
26 | | - |
27 | | - |
| 20 | +# Try to import the module - skip tests if dependencies unavailable |
| 21 | +try: |
| 22 | + from wizards_consolidated.software.tech_debt_wizard import ( |
| 23 | + DebtItem, |
| 24 | + DebtSnapshot, |
| 25 | + DebtTrajectory, |
| 26 | + TechDebtWizard, |
| 27 | + ) |
| 28 | + |
| 29 | + TECH_DEBT_AVAILABLE = True |
| 30 | +except ImportError: |
| 31 | + TECH_DEBT_AVAILABLE = False |
| 32 | + DebtItem = None |
| 33 | + DebtSnapshot = None |
| 34 | + DebtTrajectory = None |
| 35 | + TechDebtWizard = None |
| 36 | + |
| 37 | + |
| 38 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
28 | 39 | class TestDebtItem: |
29 | 40 | """Tests for DebtItem dataclass.""" |
30 | 41 |
|
@@ -101,6 +112,7 @@ def test_various_severities(self): |
101 | 112 | assert item.severity == severity |
102 | 113 |
|
103 | 114 |
|
| 115 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
104 | 116 | class TestDebtSnapshot: |
105 | 117 | """Tests for DebtSnapshot dataclass.""" |
106 | 118 |
|
@@ -152,6 +164,7 @@ def test_with_hotspots(self): |
152 | 164 | assert "src/legacy.py" in snapshot.hotspots |
153 | 165 |
|
154 | 166 |
|
| 167 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
155 | 168 | class TestDebtTrajectory: |
156 | 169 | """Tests for DebtTrajectory dataclass.""" |
157 | 170 |
|
@@ -213,6 +226,7 @@ def test_exploding_trend(self): |
213 | 226 | assert trajectory.critical_threshold_days == 30 |
214 | 227 |
|
215 | 228 |
|
| 229 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
216 | 230 | class TestTechDebtWizardInit: |
217 | 231 | """Tests for TechDebtWizard initialization.""" |
218 | 232 |
|
@@ -257,6 +271,7 @@ def test_debt_patterns_loaded(self): |
257 | 271 | assert "deprecated" in wizard.debt_patterns |
258 | 272 |
|
259 | 273 |
|
| 274 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
260 | 275 | class TestTechDebtWizardPatterns: |
261 | 276 | """Tests for debt pattern definitions.""" |
262 | 277 |
|
@@ -292,6 +307,7 @@ def test_deprecated_patterns(self): |
292 | 307 | assert any("@deprecated" in p for p in patterns) |
293 | 308 |
|
294 | 309 |
|
| 310 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
295 | 311 | class TestTechDebtWizardAnalyze: |
296 | 312 | """Tests for analyze method.""" |
297 | 313 |
|
@@ -336,6 +352,7 @@ async def test_analyze_returns_metadata(self): |
336 | 352 | assert isinstance(result, dict) |
337 | 353 |
|
338 | 354 |
|
| 355 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
339 | 356 | class TestTechDebtWizardScanning: |
340 | 357 | """Tests for debt scanning functionality.""" |
341 | 358 |
|
@@ -382,6 +399,7 @@ def test_scan_detects_hack(self): |
382 | 399 | assert any(re.search(p, content, re.IGNORECASE) for p in wizard.debt_patterns["hack"]) |
383 | 400 |
|
384 | 401 |
|
| 402 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
385 | 403 | class TestTechDebtWizardTrajectory: |
386 | 404 | """Tests for trajectory analysis.""" |
387 | 405 |
|
@@ -421,6 +439,7 @@ def test_trend_classification_exploding(self): |
421 | 439 | assert change > 50 # Exploding |
422 | 440 |
|
423 | 441 |
|
| 442 | +@pytest.mark.skipif(not TECH_DEBT_AVAILABLE, reason="Tech debt wizard dependencies not available") |
424 | 443 | class TestTechDebtWizardIntegration: |
425 | 444 | """Integration tests for TechDebtWizard.""" |
426 | 445 |
|
|
0 commit comments