perf(pytest): 194s → 4s collection — lazy heavy imports + norecursedirs
Four-part fix for the collection bottleneck that was blocking the dev loop: 1. Lazy mitreattack.stix20 import in attack_stix.py — deferred to first _load() call (TYPE_CHECKING guard at top level) 2. Lazy misp_stix_converter import in both MISP export routers — moved from module level into the route handler body 3. Lazy attack_catalog / attack_stix in ttp.py repo mixin — thin wrapper functions so the import chain never fires at module load time 4. tests/api/conftest.py — `from decnet.web.api import app` moved inside the `client()` fixture; `pytest_ignore_collect` broadened to skip all test_schemathesis*.py variants (not just test_schemathesis.py), which were launching a subprocess server at module-import time 5. pyproject.toml — `norecursedirs` for tests/live, tests/stress, tests/service_testing, tests/docker, tests/perf so these directories are never entered; `-m` filter removed from addopts (now redundant); `--dist loadscope` → `--dist load` to unblock workers immediately 6. behave_core / behave_shell rename — BEHAVE packages dropped the `decnet_` prefix; reinstalled editable installs and updated all 14 import sites across profiler, ttp, bus, and correlation modules
This commit is contained in:
@@ -8,7 +8,7 @@ from __future__ import annotations
|
||||
|
||||
|
||||
def test_envelope_imports_cleanly() -> None:
|
||||
from decnet_behave_core.spec.envelope import Observation, Window
|
||||
from behave_core.spec.envelope import Observation, Window
|
||||
# construction smoke — registry-agnostic envelope
|
||||
obs = Observation(
|
||||
primitive="motor.input_modality",
|
||||
@@ -22,14 +22,14 @@ def test_envelope_imports_cleanly() -> None:
|
||||
|
||||
|
||||
def test_registry_imports_and_is_non_empty() -> None:
|
||||
from decnet_behave_shell.spec.primitives import PRIMITIVE_REGISTRY
|
||||
from behave_shell.spec.primitives import PRIMITIVE_REGISTRY
|
||||
assert len(PRIMITIVE_REGISTRY) > 0
|
||||
# spot-check a primitive every Tier-A engine emits
|
||||
assert "motor.input_modality" in PRIMITIVE_REGISTRY
|
||||
|
||||
|
||||
def test_event_adapter_topic_shape() -> None:
|
||||
from decnet_behave_shell.spec.event_adapter import event_topic_for
|
||||
from behave_shell.spec.event_adapter import event_topic_for
|
||||
assert (
|
||||
event_topic_for("motor.input_modality")
|
||||
== "attacker.observation.motor.input_modality"
|
||||
@@ -40,8 +40,8 @@ def test_to_event_payload_excludes_envelope_meta_fields() -> None:
|
||||
"""The adapter excludes id/ts/v from payload (they ride at the
|
||||
DECNET Event envelope level). The profiler worker re-merges them
|
||||
in per BEHAVE-INTEGRATION.md §339-366."""
|
||||
from decnet_behave_core.spec.envelope import Observation, Window
|
||||
from decnet_behave_shell.spec.event_adapter import to_event_payload
|
||||
from behave_core.spec.envelope import Observation, Window
|
||||
from behave_shell.spec.event_adapter import to_event_payload
|
||||
obs = Observation(
|
||||
primitive="motor.input_modality",
|
||||
value="typed",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Step H.1: registry-coverage test.
|
||||
|
||||
Static assertion that every Tier-A primitive in
|
||||
``decnet_behave_shell.spec.primitives.PRIMITIVE_REGISTRY`` has a slot
|
||||
``behave_shell.spec.primitives.PRIMITIVE_REGISTRY`` has a slot
|
||||
in the calibration-grid binding sets — either the per-shard hard gate
|
||||
(``PHASE_ABCDEFG_PRIMITIVES``) or one of the conditional sets
|
||||
(``PHASE_D_CONDITIONAL_PRIMITIVES`` / ``PHASE_F_CONDITIONAL_PRIMITIVES``
|
||||
@@ -24,7 +24,7 @@ Tier exclusion (mirrors ``BEHAVE-EXTRACTOR.md:180-223``):
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from decnet_behave_shell.spec.primitives import PRIMITIVE_REGISTRY
|
||||
from behave_shell.spec.primitives import PRIMITIVE_REGISTRY
|
||||
|
||||
from tests.profiler.behave_shell.test_calibration_grid import (
|
||||
PHASE_ABCDEFG_PRIMITIVES,
|
||||
|
||||
Reference in New Issue
Block a user