ci/woodpecker/push/woodpecker Pipeline failed
Build and Push / lint-and-test (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.adapters.broker_adapter name:broker-adapter]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.aggregation.worker name:aggregation]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.extractor.worker name:extractor]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.ingestion.worker name:ingestion]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.lake_publisher.worker name:lake-publisher]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.parser.worker name:parser]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.recommendation.worker name:recommendation]) (push) Has been cancelled
Build and Push / build-services (map[cmd:python -m services.scheduler.app name:scheduler]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.api.app:app --host 0.0.0.0 --port 8000 name:query-api]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 name:risk]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 name:symbol-registry]) (push) Has been cancelled
Build and Push / build-services (map[cmd:uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 name:trading-engine]) (push) Has been cancelled
Build and Push / build-dashboard (push) Has been cancelled
Build and Push / build-superset (push) Has been cancelled
Build and Push / integration-test (push) Has been cancelled
- Remove --profiling-output arg from runner.yaml (plugin uses default path)
- Inline profiling hooks in root conftest.py with graceful fallback
- Replace mc-based bucket-init with Python urllib (no proxy interference)
- Add explicit ProxyHandler({}) to guarantee no proxy usage in bucket-init
67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
# Root conftest — profiling hooks for integration tests.
|
|
#
|
|
# Registers --profiling-output CLI option and writes a JSON timing report
|
|
# after the test session completes. The profiler fixture itself is defined
|
|
# in tests/integration/conftest.py (always available as a fallback) and
|
|
# optionally overridden by this plugin when it loads successfully.
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
_profiler_instance = None
|
|
_DEFAULT_OUTPUT = "/tmp/profiling-report.json"
|
|
|
|
|
|
def pytest_addoption(parser: pytest.Parser) -> None:
|
|
"""Add --profiling-output CLI flag."""
|
|
parser.addoption(
|
|
"--profiling-output",
|
|
action="store",
|
|
default=_DEFAULT_OUTPUT,
|
|
help=f"Path for the JSON profiling report (default: {_DEFAULT_OUTPUT})",
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def profiler():
|
|
"""Session-scoped EndpointProfiler instance."""
|
|
global _profiler_instance # noqa: PLW0603
|
|
try:
|
|
from tests.integration.profiler import EndpointProfiler
|
|
_profiler_instance = EndpointProfiler()
|
|
except ImportError:
|
|
# If profiler module unavailable, return a no-op object
|
|
from unittest.mock import MagicMock
|
|
_profiler_instance = MagicMock()
|
|
return _profiler_instance
|
|
|
|
|
|
def pytest_sessionfinish(session: pytest.Session, exitstatus: int) -> None:
|
|
"""Write profiling JSON report after all tests complete."""
|
|
if _profiler_instance is None:
|
|
return
|
|
output_path = session.config.getoption("profiling_output", _DEFAULT_OUTPUT)
|
|
try:
|
|
if hasattr(_profiler_instance, "write_json"):
|
|
_profiler_instance.write_json(output_path)
|
|
except (OSError, TypeError):
|
|
pass
|
|
|
|
|
|
def pytest_terminal_summary(
|
|
terminalreporter: pytest.TerminalReporter,
|
|
exitstatus: int,
|
|
config: pytest.Config,
|
|
) -> None:
|
|
"""Print profiling summary at end of test session."""
|
|
if _profiler_instance is None:
|
|
return
|
|
output_path = config.getoption("profiling_output", _DEFAULT_OUTPUT)
|
|
try:
|
|
if hasattr(_profiler_instance, "print_summary"):
|
|
terminalreporter.section("Profiling Summary")
|
|
_profiler_instance.print_summary()
|
|
terminalreporter.write_line(f"JSON report written to: {output_path}")
|
|
except (OSError, TypeError):
|
|
pass
|