diff --git a/tests/test_project_action_contracts.py b/tests/test_project_action_contracts.py index ec84d3c..0562e82 100644 --- a/tests/test_project_action_contracts.py +++ b/tests/test_project_action_contracts.py @@ -14,10 +14,20 @@ import pytest import yaml -ROOT = Path(__file__).resolve().parents[2] +from conftest import CONTRACTS_DIR + +# WHERE THE CONTRACT FAMILY IS READ (plan 038 T096; CS in T094's map, +# R2-INV-R9). Where the run is composed, `tests/conftest.py` names the family's +# composed farm CONTRACTS_DIR, and the validator is this leg's own, which reads +# that farm. In a lone checkout CONTRACTS_DIR is None, and these are the paths +# openxFactory's tree kept, above the checkout: this file's declared reason, +# `openxfactory-contracts`, as `tests/test_declared_exclusion.py` reads it. +_COMPOSED = CONTRACTS_DIR is not None +ROOT = Path(__file__).resolve().parents[1 if _COMPOSED else 2] SCRIPT = ROOT / "scripts" / "validate-ideation-dashboard-contracts.py" -SCHEMAS = ROOT / "contracts" / "schemas" -EXAMPLES = ROOT / "examples" / "ideation-dashboard" +CONTRACTS = CONTRACTS_DIR if _COMPOSED else ROOT / "contracts" +SCHEMAS = CONTRACTS / "schemas" +EXAMPLES = CONTRACTS.parent / "examples" / "ideation-dashboard" INTENT_SCHEMA = SCHEMAS / "gate-intent.schema.yaml" ACTION_SCHEMA = SCHEMAS / "gate-action-record.schema.yaml" diff --git a/tests/test_project_schema_election.py b/tests/test_project_schema_election.py index bf6d53b..8955b43 100644 --- a/tests/test_project_schema_election.py +++ b/tests/test_project_schema_election.py @@ -24,9 +24,19 @@ import pytest import yaml -ROOT = Path(__file__).resolve().parents[2] +from conftest import CONTRACTS_DIR + +# WHERE THE CONTRACT FAMILY IS READ (plan 038 T096; CS in T094's map, +# R2-INV-R9). Where the run is composed, `tests/conftest.py` names the family's +# composed farm CONTRACTS_DIR, and the validator is this leg's own, which reads +# that farm. In a lone checkout CONTRACTS_DIR is None, and these are the paths +# openxFactory's tree kept, above the checkout: this file's declared reason, +# `openxfactory-contracts`, as `tests/test_declared_exclusion.py` reads it. +_COMPOSED = CONTRACTS_DIR is not None +ROOT = Path(__file__).resolve().parents[1 if _COMPOSED else 2] SCRIPT = ROOT / "scripts" / "validate-ideation-dashboard-contracts.py" -REGISTER_SCHEMA = ROOT / "contracts" / "schemas" / "project-register.schema.yaml" +CONTRACTS = CONTRACTS_DIR if _COMPOSED else ROOT / "contracts" +REGISTER_SCHEMA = CONTRACTS / "schemas" / "project-register.schema.yaml" def _load_module(): diff --git a/tests/test_validate_ideation_dashboard_contracts.py b/tests/test_validate_ideation_dashboard_contracts.py index e90ca15..6e34c37 100644 --- a/tests/test_validate_ideation_dashboard_contracts.py +++ b/tests/test_validate_ideation_dashboard_contracts.py @@ -25,10 +25,20 @@ import pytest import yaml -ROOT = Path(__file__).resolve().parents[2] +from conftest import CONTRACTS_DIR + +# WHERE THE CONTRACT FAMILY IS READ (plan 038 T096; CS in T094's map, +# R2-INV-R9). Where the run is composed, `tests/conftest.py` names the family's +# composed farm CONTRACTS_DIR, and the validator is this leg's own, which reads +# that farm. In a lone checkout CONTRACTS_DIR is None, and these are the paths +# openxFactory's tree kept, above the checkout: this file's declared reason, +# `openxfactory-contracts`, as `tests/test_declared_exclusion.py` reads it. +_COMPOSED = CONTRACTS_DIR is not None +ROOT = Path(__file__).resolve().parents[1 if _COMPOSED else 2] SCRIPT = ROOT / "scripts" / "validate-ideation-dashboard-contracts.py" -SCHEMAS = ROOT / "contracts" / "schemas" -EXAMPLES = ROOT / "examples" / "ideation-dashboard" +CONTRACTS = CONTRACTS_DIR if _COMPOSED else ROOT / "contracts" +SCHEMAS = CONTRACTS / "schemas" +EXAMPLES = CONTRACTS.parent / "examples" / "ideation-dashboard" NEGATIVE = EXAMPLES / "negative" CATALOG_SCHEMA = SCHEMAS / "xfactory-workbench-model-catalog.schema.yaml" @@ -375,15 +385,18 @@ def test_every_schema_the_consumer_validates_is_on_disk(): schema THIS INSTALL validates is on disk, its own three always, and another kind's only where the running tree supplies it. - THE VALIDATOR IS THE INSTALLED DISTRIBUTION'S, never this module's own - `SCRIPT`, whose `ROOT` is the carve's `parents[2]`, above the checkout - (V2-10): it is the one `openxdox.snapshot.find_validator` answers, and its - sources are the ones it reports (`schema_sources`). In a lone install its - tree carries no `contracts/`, so the three come from the distribution's - packaged copies, each held to `copies.yaml`'s digest. This module's - fixtures are not used: they read openxFactory's tree, which is why the file - is declared under `openxfactory-contracts`, and F7.1 runs this case by node - id.""" + THE VALIDATOR IS THE INSTALLED DISTRIBUTION'S, the one + `openxdox.snapshot.find_validator` answers, and its sources are the ones it + reports (`schema_sources`). Run from this source tree, it is this + checkout's `scripts/validate-ideation-dashboard-contracts.py`. Where the + run is composed that is this module's `SCRIPT` too. In a lone checkout it + is not, because there `SCRIPT` is looked for at the carve's `parents[2]`, + above the checkout (V2-10). Run from an install, it is the packaged + validator. In a lone install its tree carries no `contracts/`, so the three + come from the distribution's packaged copies, each held to `copies.yaml`'s + digest. This module's fixtures are not used: in a lone checkout they read + openxFactory's tree, which is why the file is declared under + `openxfactory-contracts`, and F7.1 runs this case by node id.""" from openxdox import contracts, snapshot validator = snapshot.find_validator() diff --git a/tests/test_wheel_action_contracts.py b/tests/test_wheel_action_contracts.py index 6b748ea..0df2cc9 100644 --- a/tests/test_wheel_action_contracts.py +++ b/tests/test_wheel_action_contracts.py @@ -9,10 +9,20 @@ import pytest import yaml -ROOT = Path(__file__).resolve().parents[2] +from conftest import CONTRACTS_DIR + +# WHERE THE CONTRACT FAMILY IS READ (plan 038 T096; CS in T094's map, +# R2-INV-R9). Where the run is composed, `tests/conftest.py` names the family's +# composed farm CONTRACTS_DIR, and the validator is this leg's own, which reads +# that farm. In a lone checkout CONTRACTS_DIR is None, and these are the paths +# openxFactory's tree kept, above the checkout: this file's declared reason, +# `openxfactory-contracts`, as `tests/test_declared_exclusion.py` reads it. +_COMPOSED = CONTRACTS_DIR is not None +ROOT = Path(__file__).resolve().parents[1 if _COMPOSED else 2] SCRIPT = ROOT / "scripts" / "validate-ideation-dashboard-contracts.py" -SCHEMAS = ROOT / "contracts" / "schemas" -EXAMPLES = ROOT / "examples" / "ideation-dashboard" +CONTRACTS = CONTRACTS_DIR if _COMPOSED else ROOT / "contracts" +SCHEMAS = CONTRACTS / "schemas" +EXAMPLES = CONTRACTS.parent / "examples" / "ideation-dashboard" NEGATIVE = EXAMPLES / "negative" INTENT_SCHEMA = SCHEMAS / "gate-intent.schema.yaml"