mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-05-07 06:23:26 +08:00
* add python package builder support for FastAPI and APIRouter * lint * lint * fix merge problems * unused item * apparently didn't hit 'save' along the way * fix test expectations for indentations * handle model query params * fix test * hardening the implementation * comment typo * do not allow request-bound dependencies to be injected in the Python package * tagged * merge workspace config files * missing docstring * more linting * unused import * skip filename paths in package builder * handle dependency cleanup in command_runner * lint * get OBBject-type response model types for non-model endpoints * fix example model validator * don't count provider as a param or description check --------- Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""Root configuration for pytest."""
|
|
|
|
# flake8: noqa: S101
|
|
# pylint: disable=unused-argument,unused-import
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import pytest # noqa: F401
|
|
|
|
ROOT_DIR = Path(__file__).parent
|
|
|
|
|
|
def pytest_configure():
|
|
"""Set environment variables for testing."""
|
|
os.environ["OPENBB_AUTO_BUILD"] = "true"
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items):
|
|
"""Modify test collection to ensure cleanup-dependent tests run first."""
|
|
# Find tests that should run early (checking clean state)
|
|
early_tests: list = []
|
|
other_tests: list = []
|
|
|
|
for item in items:
|
|
# Tests that check repository state should run first
|
|
if (
|
|
"repository_state" in item.name.lower()
|
|
or "extension_map" in item.name.lower()
|
|
or "test_logging_service" in item.name.lower()
|
|
or item.get_closest_marker("order")
|
|
):
|
|
early_tests.append(item)
|
|
else:
|
|
other_tests.append(item)
|
|
|
|
# Sort early tests by their order marker if present
|
|
early_tests.sort(
|
|
key=lambda x: (
|
|
getattr(x.get_closest_marker("order"), "args", [999])[0]
|
|
if x.get_closest_marker("order")
|
|
else 999
|
|
)
|
|
)
|
|
|
|
# Reorder: early tests first, then others
|
|
items[:] = early_tests + other_tests
|