From bf5b0e3ae28c62320a9310479ed2d075ca9f6afa Mon Sep 17 00:00:00 2001 From: Yuzviak Date: Mon, 11 May 2026 19:13:42 +0300 Subject: [PATCH] fix(lint): resolve all ruff E402/I001/F821 errors - Move pytestmark after all imports in 35 test files (E402: not-at-top) - Add TYPE_CHECKING guard for FlightProcessor in composition.py (F821) - Sort import blocks in src/ and tests/ (I001 auto-fix via ruff --fix) - ruff check src/ tests/ now exits 0 with no errors Co-Authored-By: Claude Sonnet 4.6 --- src/gps_denied/components/gpr/__init__.py | 2 +- .../components/mavlink_io/__init__.py | 6 +++--- src/gps_denied/components/vio/__init__.py | 16 ++++++++-------- src/gps_denied/config.py | 2 +- src/gps_denied/core/gpr.py | 8 ++++---- src/gps_denied/core/graph.py | 2 +- src/gps_denied/core/mavlink.py | 10 +++++----- src/gps_denied/core/metric.py | 8 ++++---- src/gps_denied/core/processor.py | 2 +- src/gps_denied/hot_types/frame_state.py | 2 +- src/gps_denied/pipeline/__init__.py | 4 ++-- src/gps_denied/pipeline/composition.py | 5 ++++- src/gps_denied/pipeline/orchestrator.py | 2 +- src/gps_denied/pipeline/result_manager.py | 2 +- tests/conftest.py | 17 ++++++++--------- tests/e2e/test_coord.py | 4 ++-- tests/e2e/test_dataset_base.py | 4 ++-- tests/e2e/test_download.py | 4 ++-- tests/e2e/test_euroc.py | 4 ++-- tests/e2e/test_euroc_adapter.py | 4 ++-- tests/e2e/test_euroc_mh_all.py | 4 ++-- tests/e2e/test_euroc_vo_only.py | 4 ++-- tests/e2e/test_harness_smoke.py | 4 ++-- tests/e2e/test_mars_lvig.py | 4 ++-- tests/e2e/test_mars_lvig_adapter.py | 4 ++-- tests/e2e/test_metrics.py | 4 ++-- tests/e2e/test_synthetic_adapter.py | 2 +- tests/e2e/test_vpair.py | 4 ++-- tests/e2e/test_vpair_adapter.py | 4 ++-- tests/test_acceptance.py | 4 ++-- tests/test_accuracy.py | 4 ++-- tests/test_api_flights.py | 5 ++--- tests/test_chunk_manager.py | 4 ++-- tests/test_coordinates.py | 4 ++-- tests/test_database.py | 5 ++--- tests/test_eskf.py | 4 ++-- tests/test_gpr.py | 4 ++-- tests/test_gps_input_encoding.py | 4 ++-- tests/test_graph.py | 4 ++-- tests/test_health.py | 5 ++--- tests/test_mavlink.py | 4 ++-- tests/test_metric.py | 4 ++-- tests/test_pipeline.py | 4 ++-- tests/test_processor_full.py | 4 ++-- tests/test_processor_pipe.py | 4 ++-- tests/test_recovery.py | 4 ++-- tests/test_rotation.py | 4 ++-- tests/test_satellite.py | 4 ++-- tests/test_schemas.py | 5 ++--- tests/test_vo.py | 4 ++-- 50 files changed, 114 insertions(+), 116 deletions(-) diff --git a/src/gps_denied/components/gpr/__init__.py b/src/gps_denied/components/gpr/__init__.py index 30bf1be..9e738b6 100644 --- a/src/gps_denied/components/gpr/__init__.py +++ b/src/gps_denied/components/gpr/__init__.py @@ -6,9 +6,9 @@ re-exported as ``IGlobalPlaceRecognition``. """ from gps_denied.components.gpr.faiss_gpr import ( # noqa: F401 + _FAISS_AVAILABLE, GlobalPlaceRecognition, _faiss, - _FAISS_AVAILABLE, ) from gps_denied.components.gpr.protocol import ( # noqa: F401 IGlobalPlaceRecognition, diff --git a/src/gps_denied/components/mavlink_io/__init__.py b/src/gps_denied/components/mavlink_io/__init__.py index daadd7b..6f31534 100644 --- a/src/gps_denied/components/mavlink_io/__init__.py +++ b/src/gps_denied/components/mavlink_io/__init__.py @@ -1,12 +1,12 @@ +from .mock_mavlink import MockMAVConnection from .protocol import MAVLinkBridgeProtocol from .pymavlink_bridge import ( - MAVLinkBridge, _PYMAVLINK_AVAILABLE, - _unix_to_gps_time, + MAVLinkBridge, _confidence_to_fix_type, _eskf_to_gps_input, + _unix_to_gps_time, ) -from .mock_mavlink import MockMAVConnection __all__ = [ "MAVLinkBridgeProtocol", diff --git a/src/gps_denied/components/vio/__init__.py b/src/gps_denied/components/vio/__init__.py index 9cec953..0484efa 100644 --- a/src/gps_denied/components/vio/__init__.py +++ b/src/gps_denied/components/vio/__init__.py @@ -12,19 +12,19 @@ the legacy ``core/vo.py`` monolith into per-backend modules: The legacy ``gps_denied.core.vo`` import path is preserved as a thin re-export shim for one phase; tests still import from there. """ -from gps_denied.components.vio.protocol import ( - ISequentialVisualOdometry, - VisualOdometry, -) -from gps_denied.components.vio.orbslam_backend import ( - ORBVisualOdometry, - SequentialVisualOdometry, -) from gps_denied.components.vio.cuvslam_backend import ( CuVSLAMMonoDepthVisualOdometry, CuVSLAMVisualOdometry, ) from gps_denied.components.vio.factory import create_vo_backend +from gps_denied.components.vio.orbslam_backend import ( + ORBVisualOdometry, + SequentialVisualOdometry, +) +from gps_denied.components.vio.protocol import ( + ISequentialVisualOdometry, + VisualOdometry, +) __all__ = [ "VisualOdometry", diff --git a/src/gps_denied/config.py b/src/gps_denied/config.py index e5e5741..04c656b 100644 --- a/src/gps_denied/config.py +++ b/src/gps_denied/config.py @@ -181,7 +181,7 @@ class AppSettings(BaseSettings): def settings_customise_sources(cls, settings_cls, **kwargs): """Load YAML overlay from config/{env}.yaml when present.""" import os - import yaml + init_kwargs = kwargs.get("init_settings") env_settings = kwargs.get("env_settings") diff --git a/src/gps_denied/core/gpr.py b/src/gps_denied/core/gpr.py index 745ca48..966e954 100644 --- a/src/gps_denied/core/gpr.py +++ b/src/gps_denied/core/gpr.py @@ -1,11 +1,11 @@ """Legacy import path for GPR. Phase 1 shim — code lives in components/gpr/.""" -from gps_denied.components.gpr.protocol import ( - IGlobalPlaceRecognition, # noqa: F401 -) from gps_denied.components.gpr.faiss_gpr import ( + _FAISS_AVAILABLE, GlobalPlaceRecognition, _faiss, - _FAISS_AVAILABLE, +) +from gps_denied.components.gpr.protocol import ( + IGlobalPlaceRecognition, # noqa: F401 ) __all__ = [ diff --git a/src/gps_denied/core/graph.py b/src/gps_denied/core/graph.py index 1974dd5..9737640 100644 --- a/src/gps_denied/core/graph.py +++ b/src/gps_denied/core/graph.py @@ -1,5 +1,5 @@ """Legacy import path. Phase 1 shim — code lives in core/factor_graph.py.""" from gps_denied.core.factor_graph import ( # noqa: F401 - IFactorGraphOptimizer, FactorGraphOptimizer, + IFactorGraphOptimizer, ) diff --git a/src/gps_denied/core/mavlink.py b/src/gps_denied/core/mavlink.py index 1083d63..015d088 100644 --- a/src/gps_denied/core/mavlink.py +++ b/src/gps_denied/core/mavlink.py @@ -4,18 +4,18 @@ CRITICAL: tests/test_mavlink.py and tests/test_gps_input_encoding.py import private helpers from this path. Per PATTERNS.md §6.2, the underscore names MUST be re-exported here verbatim or 12+ tests break. """ +from gps_denied.components.mavlink_io.mock_mavlink import ( # noqa: F401 + MockMAVConnection, +) from gps_denied.components.mavlink_io.protocol import ( # noqa: F401 MAVLinkBridgeProtocol, ) from gps_denied.components.mavlink_io.pymavlink_bridge import ( # noqa: F401 - MAVLinkBridge, _PYMAVLINK_AVAILABLE, - _unix_to_gps_time, + MAVLinkBridge, _confidence_to_fix_type, _eskf_to_gps_input, -) -from gps_denied.components.mavlink_io.mock_mavlink import ( # noqa: F401 - MockMAVConnection, + _unix_to_gps_time, ) __all__ = [ diff --git a/src/gps_denied/core/metric.py b/src/gps_denied/core/metric.py index 23d93ef..e1ca4ef 100644 --- a/src/gps_denied/core/metric.py +++ b/src/gps_denied/core/metric.py @@ -1,10 +1,10 @@ """Legacy import path. Phase 1 shim — code lives in components/satellite_matcher/.""" -from gps_denied.components.satellite_matcher.protocol import ( # noqa: F401 - MetricRefiner, - IMetricRefinement, -) from gps_denied.components.satellite_matcher.metric_refinement import ( # noqa: F401 MetricRefinement, ) +from gps_denied.components.satellite_matcher.protocol import ( # noqa: F401 + IMetricRefinement, + MetricRefiner, +) __all__ = ["MetricRefinement", "IMetricRefinement", "MetricRefiner"] diff --git a/src/gps_denied/core/processor.py b/src/gps_denied/core/processor.py index 6a61f85..d229b98 100644 --- a/src/gps_denied/core/processor.py +++ b/src/gps_denied/core/processor.py @@ -1,6 +1,6 @@ """Legacy import path. Phase 1 shim — code lives in pipeline/orchestrator.py.""" from gps_denied.pipeline.orchestrator import ( # noqa: F401 FlightProcessor, - TrackingState, FrameResult, + TrackingState, ) diff --git a/src/gps_denied/hot_types/frame_state.py b/src/gps_denied/hot_types/frame_state.py index 6fca5da..dda13df 100644 --- a/src/gps_denied/hot_types/frame_state.py +++ b/src/gps_denied/hot_types/frame_state.py @@ -15,7 +15,7 @@ introduces this type. from __future__ import annotations from dataclasses import dataclass -from typing import Optional, TYPE_CHECKING +from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from gps_denied.schemas import GPSPoint diff --git a/src/gps_denied/pipeline/__init__.py b/src/gps_denied/pipeline/__init__.py index 1c6600b..b3dedae 100644 --- a/src/gps_denied/pipeline/__init__.py +++ b/src/gps_denied/pipeline/__init__.py @@ -1,9 +1,9 @@ """Pipeline package: orchestrator + IO + composition root.""" -from .orchestrator import FlightProcessor +from .composition import build_pipeline from .image_input import ImageInputPipeline +from .orchestrator import FlightProcessor from .result_manager import ResultManager from .sse_streamer import SSEEventStreamer -from .composition import build_pipeline Pipeline = FlightProcessor diff --git a/src/gps_denied/pipeline/composition.py b/src/gps_denied/pipeline/composition.py index 263df59..1af8059 100644 --- a/src/gps_denied/pipeline/composition.py +++ b/src/gps_denied/pipeline/composition.py @@ -15,10 +15,13 @@ Env-conditional wiring from __future__ import annotations import logging -from typing import Optional +from typing import TYPE_CHECKING from gps_denied.obs import configure_logging +if TYPE_CHECKING: + from gps_denied.pipeline.orchestrator import FlightProcessor + logger = logging.getLogger(__name__) diff --git a/src/gps_denied/pipeline/orchestrator.py b/src/gps_denied/pipeline/orchestrator.py index 09d31ac..de81832 100644 --- a/src/gps_denied/pipeline/orchestrator.py +++ b/src/gps_denied/pipeline/orchestrator.py @@ -16,10 +16,10 @@ import structlog from structlog.contextvars import bind_contextvars, clear_contextvars from gps_denied.core.eskf import ESKF +from gps_denied.db.repository import FlightRepository from gps_denied.pipeline.image_input import ImageInputPipeline from gps_denied.pipeline.result_manager import ResultManager from gps_denied.pipeline.sse_streamer import SSEEventStreamer -from gps_denied.db.repository import FlightRepository from gps_denied.schemas import CameraParameters, GPSPoint from gps_denied.schemas.flight import ( BatchMetadata, diff --git a/src/gps_denied/pipeline/result_manager.py b/src/gps_denied/pipeline/result_manager.py index b53cd59..a734729 100644 --- a/src/gps_denied/pipeline/result_manager.py +++ b/src/gps_denied/pipeline/result_manager.py @@ -4,8 +4,8 @@ from __future__ import annotations from datetime import datetime -from gps_denied.pipeline.sse_streamer import SSEEventStreamer from gps_denied.db.repository import FlightRepository +from gps_denied.pipeline.sse_streamer import SSEEventStreamer from gps_denied.schemas import GPSPoint from gps_denied.schemas.events import FrameProcessedEvent diff --git a/tests/conftest.py b/tests/conftest.py index 1899cdb..c259e6c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,14 +1,5 @@ """Shared test fixtures for GPS-denied-onboard test suite.""" -from unittest.mock import AsyncMock, MagicMock - -import numpy as np -import pytest - -from gps_denied.core.coordinates import CoordinateTransformer -from gps_denied.core.models import ModelManager -from gps_denied.schemas import CameraParameters, GPSPoint - # --------------------------------------------------------------- # Phase 2 / TEST-03: AC traceability plugin # @@ -23,6 +14,14 @@ import json import re from collections import defaultdict from pathlib import Path +from unittest.mock import AsyncMock, MagicMock + +import numpy as np +import pytest + +from gps_denied.core.coordinates import CoordinateTransformer +from gps_denied.core.models import ModelManager +from gps_denied.schemas import CameraParameters, GPSPoint _AC_ID_RE = re.compile(r"^AC-(?:\d+\.\d+[a-z]?|NEW-\d+)$") diff --git a/tests/e2e/test_coord.py b/tests/e2e/test_coord.py index 86d05eb..e9c5153 100644 --- a/tests/e2e/test_coord.py +++ b/tests/e2e/test_coord.py @@ -3,10 +3,10 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.testing.coord import ecef_to_wgs84, euler_to_quaternion +pytestmark = [pytest.mark.unit] + # --- ECEF → WGS84 --- def test_ecef_origin_is_on_equator_prime_meridian(): diff --git a/tests/e2e/test_dataset_base.py b/tests/e2e/test_dataset_base.py index 784e191..7751553 100644 --- a/tests/e2e/test_dataset_base.py +++ b/tests/e2e/test_dataset_base.py @@ -2,8 +2,6 @@ import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.testing.datasets.base import ( DatasetAdapter, DatasetCapabilities, @@ -14,6 +12,8 @@ from gps_denied.testing.datasets.base import ( PlatformClass, ) +pytestmark = [pytest.mark.unit] + def test_capabilities_defaults(): cap = DatasetCapabilities( diff --git a/tests/e2e/test_download.py b/tests/e2e/test_download.py index 8445eb8..14e5b49 100644 --- a/tests/e2e/test_download.py +++ b/tests/e2e/test_download.py @@ -5,8 +5,6 @@ from pathlib import Path import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.testing.download import ( DATASET_REGISTRY, DatasetSpec, @@ -14,6 +12,8 @@ from gps_denied.testing.download import ( verify_sha256, ) +pytestmark = [pytest.mark.unit] + def test_registry_has_euroc_machine_hall(): assert "euroc_machine_hall" in DATASET_REGISTRY diff --git a/tests/e2e/test_euroc.py b/tests/e2e/test_euroc.py index 4d479e7..a3b8cbe 100644 --- a/tests/e2e/test_euroc.py +++ b/tests/e2e/test_euroc.py @@ -13,12 +13,12 @@ from pathlib import Path import pytest -pytestmark = [pytest.mark.e2e] - from gps_denied.testing.datasets.euroc import EuRoCAdapter from gps_denied.testing.harness import E2EHarness from gps_denied.testing.metrics import absolute_trajectory_error +pytestmark = [pytest.mark.e2e] + # CI-tier keeps the prefix short so a full run stays under a couple of minutes. EUROC_MH01_MAX_FRAMES = 100 diff --git a/tests/e2e/test_euroc_adapter.py b/tests/e2e/test_euroc_adapter.py index b4cc33b..5eef31a 100644 --- a/tests/e2e/test_euroc_adapter.py +++ b/tests/e2e/test_euroc_adapter.py @@ -4,14 +4,14 @@ from pathlib import Path import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.testing.datasets.base import ( DatasetNotAvailableError, PlatformClass, ) from gps_denied.testing.datasets.euroc import EuRoCAdapter +pytestmark = [pytest.mark.unit] + @pytest.fixture def fake_euroc_root(tmp_path: Path) -> Path: diff --git a/tests/e2e/test_euroc_mh_all.py b/tests/e2e/test_euroc_mh_all.py index 3a095a8..0059d1b 100644 --- a/tests/e2e/test_euroc_mh_all.py +++ b/tests/e2e/test_euroc_mh_all.py @@ -17,12 +17,12 @@ from pathlib import Path import pytest -pytestmark = [pytest.mark.e2e] - from gps_denied.testing.datasets.euroc import EuRoCAdapter from gps_denied.testing.harness import E2EHarness from gps_denied.testing.metrics import absolute_trajectory_error +pytestmark = [pytest.mark.e2e] + MAX_FRAMES = 100 VO_SCALE_M = 0.005 # 5 mm/frame — measured GT median on MH_01 diff --git a/tests/e2e/test_euroc_vo_only.py b/tests/e2e/test_euroc_vo_only.py index 480333c..5d2d47f 100644 --- a/tests/e2e/test_euroc_vo_only.py +++ b/tests/e2e/test_euroc_vo_only.py @@ -20,12 +20,12 @@ import cv2 import numpy as np import pytest -pytestmark = [pytest.mark.e2e] - from gps_denied.core.vo import ORBVisualOdometry from gps_denied.schemas import CameraParameters from gps_denied.testing.datasets.euroc import EuRoCAdapter +pytestmark = [pytest.mark.e2e] + # Match CI-tier frame cap used in test_euroc.py EUROC_MH01_MAX_FRAMES = 100 diff --git a/tests/e2e/test_harness_smoke.py b/tests/e2e/test_harness_smoke.py index 3e5637b..bb1d697 100644 --- a/tests/e2e/test_harness_smoke.py +++ b/tests/e2e/test_harness_smoke.py @@ -7,11 +7,11 @@ Correctness of VO on synthetic is out of scope — that's unit-test territory. import pytest -pytestmark = [pytest.mark.integration] - from gps_denied.testing.datasets.synthetic import SyntheticAdapter from gps_denied.testing.harness import E2EHarness, HarnessResult +pytestmark = [pytest.mark.integration] + @pytest.mark.asyncio async def test_harness_processes_every_frame(): diff --git a/tests/e2e/test_mars_lvig.py b/tests/e2e/test_mars_lvig.py index a78ea98..d1bfc72 100644 --- a/tests/e2e/test_mars_lvig.py +++ b/tests/e2e/test_mars_lvig.py @@ -4,11 +4,11 @@ from pathlib import Path import pytest -pytestmark = [pytest.mark.e2e] - from gps_denied.testing.datasets.mars_lvig import MARSLVIGAdapter from gps_denied.testing.harness import E2EHarness +pytestmark = [pytest.mark.e2e] + # Stress tier does not gate on RMSE — featureless sequences legitimately cause # tracking loss. The gate is whether the pipeline RUNS TO COMPLETION without # crashing, and what fraction of frames produced any estimate at all. diff --git a/tests/e2e/test_mars_lvig_adapter.py b/tests/e2e/test_mars_lvig_adapter.py index 706d718..2032f49 100644 --- a/tests/e2e/test_mars_lvig_adapter.py +++ b/tests/e2e/test_mars_lvig_adapter.py @@ -4,14 +4,14 @@ from pathlib import Path import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.testing.datasets.base import ( DatasetNotAvailableError, PlatformClass, ) from gps_denied.testing.datasets.mars_lvig import MARSLVIGAdapter +pytestmark = [pytest.mark.unit] + @pytest.fixture def fake_mars_seq(tmp_path: Path) -> Path: diff --git a/tests/e2e/test_metrics.py b/tests/e2e/test_metrics.py index 158cd74..bf4d32f 100644 --- a/tests/e2e/test_metrics.py +++ b/tests/e2e/test_metrics.py @@ -3,14 +3,14 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.testing.metrics import ( absolute_trajectory_error, relative_pose_error, trajectory_rmse, ) +pytestmark = [pytest.mark.unit] + def test_rmse_identical_trajectories_is_zero(): est = np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [2.0, 0.0, 0.0]]) diff --git a/tests/e2e/test_synthetic_adapter.py b/tests/e2e/test_synthetic_adapter.py index 33feb33..04e32c6 100644 --- a/tests/e2e/test_synthetic_adapter.py +++ b/tests/e2e/test_synthetic_adapter.py @@ -4,9 +4,9 @@ import numpy as np import pytest from gps_denied.testing.datasets.base import PlatformClass +from gps_denied.testing.datasets.synthetic import SyntheticAdapter pytestmark = [pytest.mark.unit] -from gps_denied.testing.datasets.synthetic import SyntheticAdapter def test_synthetic_has_raw_imu(): diff --git a/tests/e2e/test_vpair.py b/tests/e2e/test_vpair.py index 7c74c43..94bd4bd 100644 --- a/tests/e2e/test_vpair.py +++ b/tests/e2e/test_vpair.py @@ -8,12 +8,12 @@ from pathlib import Path import pytest -pytestmark = [pytest.mark.e2e] - from gps_denied.testing.datasets.vpair import VPAIRAdapter from gps_denied.testing.harness import E2EHarness from gps_denied.testing.metrics import absolute_trajectory_error +pytestmark = [pytest.mark.e2e] + VPAIR_SAMPLE_RMSE_CEILING_M = 20.0 # initial target, calibrate after first runs diff --git a/tests/e2e/test_vpair_adapter.py b/tests/e2e/test_vpair_adapter.py index 8c59eea..23ea484 100644 --- a/tests/e2e/test_vpair_adapter.py +++ b/tests/e2e/test_vpair_adapter.py @@ -10,14 +10,14 @@ from pathlib import Path import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.testing.datasets.base import ( DatasetNotAvailableError, PlatformClass, ) from gps_denied.testing.datasets.vpair import VPAIRAdapter +pytestmark = [pytest.mark.unit] + # ECEF for a point at roughly lat=50.737°, lon=7.095°, alt=350m (Bonn/Eifel region). # Chosen to hit the real VPAIR geographic area so the adapter's conversion # produces plausible numbers the tests can assert on. diff --git a/tests/test_acceptance.py b/tests/test_acceptance.py index 35c0f8b..d80bd43 100644 --- a/tests/test_acceptance.py +++ b/tests/test_acceptance.py @@ -13,8 +13,6 @@ from unittest.mock import AsyncMock, MagicMock import numpy as np import pytest -pytestmark = [pytest.mark.integration] - from gps_denied.core.chunk_manager import RouteChunkManager from gps_denied.core.gpr import GlobalPlaceRecognition from gps_denied.core.graph import FactorGraphOptimizer @@ -25,6 +23,8 @@ from gps_denied.core.recovery import FailureRecoveryCoordinator from gps_denied.core.vo import SequentialVisualOdometry from gps_denied.schemas.graph import FactorGraphConfig +pytestmark = [pytest.mark.integration] + # --------------------------------------------------------------- # Fixtures diff --git a/tests/test_accuracy.py b/tests/test_accuracy.py index 58b873d..dda93e1 100644 --- a/tests/test_accuracy.py +++ b/tests/test_accuracy.py @@ -22,8 +22,6 @@ import time import numpy as np import pytest -pytestmark = [pytest.mark.integration] - from gps_denied.core.benchmark import ( AccuracyBenchmark, BenchmarkResult, @@ -33,6 +31,8 @@ from gps_denied.core.benchmark import ( from gps_denied.schemas import GPSPoint from gps_denied.schemas.eskf import ESKFConfig +pytestmark = [pytest.mark.integration] + ORIGIN = GPSPoint(lat=49.0, lon=32.0) diff --git a/tests/test_api_flights.py b/tests/test_api_flights.py index 1e4789f..8e01d8b 100644 --- a/tests/test_api_flights.py +++ b/tests/test_api_flights.py @@ -3,9 +3,6 @@ import json import pytest - -pytestmark = [pytest.mark.integration] - from httpx import ASGITransport, AsyncClient from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine @@ -13,6 +10,8 @@ from gps_denied.app import app from gps_denied.db.engine import get_session from gps_denied.db.models import Base +pytestmark = [pytest.mark.integration] + @pytest.fixture async def override_get_session(): diff --git a/tests/test_chunk_manager.py b/tests/test_chunk_manager.py index 12d19bb..8b320b7 100644 --- a/tests/test_chunk_manager.py +++ b/tests/test_chunk_manager.py @@ -3,14 +3,14 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.chunk_manager import RouteChunkManager from gps_denied.core.graph import FactorGraphOptimizer from gps_denied.schemas.chunk import ChunkStatus from gps_denied.schemas.graph import FactorGraphConfig from gps_denied.schemas.metric import Sim3Transform +pytestmark = [pytest.mark.unit] + @pytest.fixture def chunk_manager(): diff --git a/tests/test_coordinates.py b/tests/test_coordinates.py index 9a231b3..8cf8913 100644 --- a/tests/test_coordinates.py +++ b/tests/test_coordinates.py @@ -3,8 +3,6 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.coordinates import ( CoordinateTransformer, OriginNotSetError, @@ -14,6 +12,8 @@ from gps_denied.core.coordinates import ( ) from gps_denied.schemas import CameraParameters, GPSPoint +pytestmark = [pytest.mark.unit] + @pytest.fixture def transformer(): diff --git a/tests/test_database.py b/tests/test_database.py index c9a173c..433f31d 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -1,15 +1,14 @@ """Tests for the database layer — CRUD, cascade, transactions.""" import pytest - -pytestmark = [pytest.mark.integration] - from sqlalchemy import event from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from gps_denied.db.models import Base from gps_denied.db.repository import FlightRepository +pytestmark = [pytest.mark.integration] + @pytest.fixture async def session(): diff --git a/tests/test_eskf.py b/tests/test_eskf.py index 4eb473f..9828278 100644 --- a/tests/test_eskf.py +++ b/tests/test_eskf.py @@ -3,13 +3,13 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.coordinates import CoordinateTransformer from gps_denied.core.eskf import ESKF from gps_denied.schemas import GPSPoint from gps_denied.schemas.eskf import ConfidenceTier, ESKFConfig, IMUMeasurement +pytestmark = [pytest.mark.unit] + @pytest.fixture def eskf(): diff --git a/tests/test_gpr.py b/tests/test_gpr.py index 34ae31d..7ffe858 100644 --- a/tests/test_gpr.py +++ b/tests/test_gpr.py @@ -3,12 +3,12 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.gpr import GlobalPlaceRecognition from gps_denied.core.models import ModelManager from gps_denied.schemas.gpr import TileCandidate +pytestmark = [pytest.mark.unit] + @pytest.fixture def gpr(): diff --git a/tests/test_gps_input_encoding.py b/tests/test_gps_input_encoding.py index 7b3d4dc..14ca503 100644 --- a/tests/test_gps_input_encoding.py +++ b/tests/test_gps_input_encoding.py @@ -17,12 +17,12 @@ import time import numpy as np import pytest -pytestmark = [pytest.mark.blackbox, pytest.mark.ac("AC-4.3")] - from gps_denied.core.mavlink import _confidence_to_fix_type, _eskf_to_gps_input from gps_denied.schemas import GPSPoint from gps_denied.schemas.eskf import ConfidenceTier, ESKFState +pytestmark = [pytest.mark.blackbox, pytest.mark.ac("AC-4.3")] + _ORIGIN = GPSPoint(lat=49.0, lon=32.0) diff --git a/tests/test_graph.py b/tests/test_graph.py index 43f112f..b8c23bc 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -3,14 +3,14 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.graph import FactorGraphOptimizer from gps_denied.schemas import GPSPoint from gps_denied.schemas.graph import FactorGraphConfig from gps_denied.schemas.metric import Sim3Transform from gps_denied.schemas.vo import RelativePose +pytestmark = [pytest.mark.unit] + @pytest.fixture def optimizer(): diff --git a/tests/test_health.py b/tests/test_health.py index d696082..fb0db22 100644 --- a/tests/test_health.py +++ b/tests/test_health.py @@ -1,13 +1,12 @@ """Tests for the health endpoint.""" import pytest - -pytestmark = [pytest.mark.integration] - from httpx import ASGITransport, AsyncClient from gps_denied.app import app +pytestmark = [pytest.mark.integration] + @pytest.mark.asyncio async def test_health_returns_ok(): diff --git a/tests/test_mavlink.py b/tests/test_mavlink.py index 4b3602d..015c010 100644 --- a/tests/test_mavlink.py +++ b/tests/test_mavlink.py @@ -14,8 +14,6 @@ import time import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.mavlink import ( MAVLinkBridge, MockMAVConnection, @@ -27,6 +25,8 @@ from gps_denied.schemas import GPSPoint from gps_denied.schemas.eskf import ConfidenceTier, ESKFState from gps_denied.schemas.mavlink import GPSInputMessage, RelocalizationRequest +pytestmark = [pytest.mark.unit] + # --------------------------------------------------------------- # Helpers # --------------------------------------------------------------- diff --git a/tests/test_metric.py b/tests/test_metric.py index ccaf0c2..e977cbe 100644 --- a/tests/test_metric.py +++ b/tests/test_metric.py @@ -3,14 +3,14 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.metric import MetricRefinement from gps_denied.core.models import ModelManager from gps_denied.schemas import GPSPoint from gps_denied.schemas.metric import AlignmentResult, ChunkAlignmentResult from gps_denied.schemas.satellite import TileBounds +pytestmark = [pytest.mark.unit] + @pytest.fixture def metric(): diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 90a56fd..5dde4ac 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -5,11 +5,11 @@ import cv2 import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.pipeline import ImageInputPipeline, QueueFullError from gps_denied.schemas.image import ImageBatch +pytestmark = [pytest.mark.unit] + @pytest.fixture def pipeline(tmp_path): diff --git a/tests/test_processor_full.py b/tests/test_processor_full.py index c53ca77..034eda7 100644 --- a/tests/test_processor_full.py +++ b/tests/test_processor_full.py @@ -5,8 +5,6 @@ from unittest.mock import AsyncMock, MagicMock import numpy as np import pytest -pytestmark = [pytest.mark.integration] - from gps_denied.core.chunk_manager import RouteChunkManager from gps_denied.core.gpr import GlobalPlaceRecognition from gps_denied.core.graph import FactorGraphOptimizer @@ -17,6 +15,8 @@ from gps_denied.core.recovery import FailureRecoveryCoordinator from gps_denied.core.vo import SequentialVisualOdometry from gps_denied.schemas.graph import FactorGraphConfig +pytestmark = [pytest.mark.integration] + @pytest.fixture def processor(): diff --git a/tests/test_processor_pipe.py b/tests/test_processor_pipe.py index cd2ad7b..3ecd318 100644 --- a/tests/test_processor_pipe.py +++ b/tests/test_processor_pipe.py @@ -14,14 +14,14 @@ from unittest.mock import AsyncMock, MagicMock import numpy as np import pytest -pytestmark = [pytest.mark.integration] - from gps_denied.core.coordinates import CoordinateTransformer from gps_denied.core.processor import FlightProcessor, TrackingState from gps_denied.core.rotation import ImageRotationManager from gps_denied.schemas import CameraParameters, GPSPoint from gps_denied.schemas.vo import RelativePose +pytestmark = [pytest.mark.integration] + # --------------------------------------------------------------- # Helpers # --------------------------------------------------------------- diff --git a/tests/test_recovery.py b/tests/test_recovery.py index 66adb56..3713790 100644 --- a/tests/test_recovery.py +++ b/tests/test_recovery.py @@ -3,8 +3,6 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.chunk_manager import RouteChunkManager from gps_denied.core.gpr import GlobalPlaceRecognition from gps_denied.core.graph import FactorGraphOptimizer @@ -13,6 +11,8 @@ from gps_denied.core.models import ModelManager from gps_denied.core.recovery import FailureRecoveryCoordinator from gps_denied.schemas.graph import FactorGraphConfig +pytestmark = [pytest.mark.unit] + @pytest.fixture def recovery(): diff --git a/tests/test_rotation.py b/tests/test_rotation.py index 92531dc..7e7d474 100644 --- a/tests/test_rotation.py +++ b/tests/test_rotation.py @@ -5,13 +5,13 @@ from datetime import datetime, timezone import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.rotation import IImageMatcher, ImageRotationManager from gps_denied.schemas import GPSPoint from gps_denied.schemas.rotation import RotationResult from gps_denied.schemas.satellite import TileBounds +pytestmark = [pytest.mark.unit] + @pytest.fixture def rotation_manager(): diff --git a/tests/test_satellite.py b/tests/test_satellite.py index 923716e..21459e1 100644 --- a/tests/test_satellite.py +++ b/tests/test_satellite.py @@ -3,12 +3,12 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.satellite import SatelliteDataManager from gps_denied.schemas import GPSPoint from gps_denied.utils import mercator +pytestmark = [pytest.mark.unit] + # --------------------------------------------------------------- # Mercator utils # --------------------------------------------------------------- diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 9698e5a..945c203 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -3,9 +3,6 @@ from datetime import datetime, timezone import pytest - -pytestmark = [pytest.mark.unit] - from pydantic import ValidationError from gps_denied.config import get_settings @@ -20,6 +17,8 @@ from gps_denied.schemas.flight import ( Waypoint, ) +pytestmark = [pytest.mark.unit] + # ── GPSPoint ────────────────────────────────────────────────────────────── @pytest.mark.ac("AC-6.3") diff --git a/tests/test_vo.py b/tests/test_vo.py index bd7a61a..c5b633d 100644 --- a/tests/test_vo.py +++ b/tests/test_vo.py @@ -3,8 +3,6 @@ import numpy as np import pytest -pytestmark = [pytest.mark.unit] - from gps_denied.core.models import ModelManager from gps_denied.core.vo import ( CuVSLAMVisualOdometry, @@ -16,6 +14,8 @@ from gps_denied.core.vo import ( from gps_denied.schemas import CameraParameters from gps_denied.schemas.vo import Features, Matches +pytestmark = [pytest.mark.unit] + @pytest.fixture def vo():