|
5 | 5 | produces valid SystemIR, passes verification, and yields correct canonical |
6 | 6 | h = f . g decomposition. |
7 | 7 |
|
| 8 | +These tests require all DSL packages to be installed. When run in isolation |
| 9 | +(e.g. ``--package gds-framework``), the entire module is skipped. |
| 10 | +
|
8 | 11 | Run with: |
9 | 12 | uv run pytest packages/gds-framework/tests/test_cross_dsl_integration.py -v |
10 | 13 | """ |
11 | 14 |
|
| 15 | +import importlib |
| 16 | + |
12 | 17 | import pytest |
13 | 18 |
|
14 | 19 | from gds.canonical import project_canonical |
15 | 20 | from gds.ir.models import SystemIR |
16 | 21 | from gds.spec import GDSSpec |
17 | 22 |
|
| 23 | +# Skip entire module if any DSL package is missing (CI runs per-package) |
| 24 | +_REQUIRED = ["stockflow", "gds_control", "ogs", "gds_software", "gds_business"] |
| 25 | +_missing = [m for m in _REQUIRED if importlib.util.find_spec(m) is None] |
| 26 | +pytestmark = pytest.mark.skipif( |
| 27 | + len(_missing) > 0, |
| 28 | + reason=f"Cross-DSL tests require all DSL packages; missing: {_missing}", |
| 29 | +) |
| 30 | + |
18 | 31 | # ════════════════════════════════════════════════════════════════ |
19 | 32 | # StockFlow DSL |
20 | 33 | # ════════════════════════════════════════════════════════════════ |
@@ -117,7 +130,6 @@ def test_spec_validates(self, minimal_model): |
117 | 130 | # Control DSL |
118 | 131 | # ════════════════════════════════════════════════════════════════ |
119 | 132 |
|
120 | | - |
121 | 133 | class TestControlRoundTrip: |
122 | 134 | """Control: declare → compile → verify → canonical.""" |
123 | 135 |
|
@@ -213,7 +225,6 @@ def test_spec_validates(self, minimal_model): |
213 | 225 | # OGS (Games) DSL |
214 | 226 | # ════════════════════════════════════════════════════════════════ |
215 | 227 |
|
216 | | - |
217 | 228 | class TestOGSRoundTrip: |
218 | 229 | """OGS: Pattern → compile_pattern_to_spec → canonical.""" |
219 | 230 |
|
@@ -317,7 +328,6 @@ def test_pattern_ir_to_system_ir(self, single_decision): |
317 | 328 | # Software DSL |
318 | 329 | # ════════════════════════════════════════════════════════════════ |
319 | 330 |
|
320 | | - |
321 | 331 | class TestSoftwareRoundTrip: |
322 | 332 | """Software: each diagram type compiles through GDS pipeline.""" |
323 | 333 |
|
@@ -411,7 +421,6 @@ def test_dfd_verify(self, dfd_model): |
411 | 421 | # Business DSL |
412 | 422 | # ════════════════════════════════════════════════════════════════ |
413 | 423 |
|
414 | | - |
415 | 424 | class TestBusinessRoundTrip: |
416 | 425 | """Business: CLD, SCN, VSM compile through GDS pipeline.""" |
417 | 426 |
|
@@ -446,10 +455,10 @@ def scn_model(self): |
446 | 455 | SupplyNode(name="Retailer"), |
447 | 456 | ], |
448 | 457 | shipments=[ |
449 | | - Shipment(name="F->R", source_node="Factory", target_node="Retailer"), |
| 458 | + Shipment(name="F->R", source="Factory", target="Retailer"), |
450 | 459 | ], |
451 | 460 | demand_sources=[ |
452 | | - DemandSource(name="Customer", target_node="Retailer"), |
| 461 | + DemandSource(name="Customer", target="Retailer"), |
453 | 462 | ], |
454 | 463 | order_policies=[ |
455 | 464 | OrderPolicy(name="Reorder", node="Retailer", inputs=["Retailer"]), |
|
0 commit comments