Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions tests/instruments/test_cors_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def test_cors_instrument_config_defaults() -> None:
assert config.cors_max_age == expected_max_age


def test_cors_dependencies_installed() -> None:
assert CorsInstrument.dependencies_installed() is True


@pytest.mark.parametrize(
("origins", "regex"),
[
Expand Down
4 changes: 0 additions & 4 deletions tests/instruments/test_healthchecks_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ def test_healthchecks_config_defaults() -> None:
assert config.health_checks_probes == {}


def test_healthchecks_dependencies_installed() -> None:
assert HealthChecksInstrument.dependencies_installed() is True


async def test_healthchecks_probes_run_concurrently() -> None:
interval = 0.2

Expand Down
4 changes: 0 additions & 4 deletions tests/instruments/test_swagger_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ def test_swagger_config_defaults() -> None:
assert config.swagger_static_path == "/static"
assert config.swagger_path == "/docs"
assert config.swagger_offline_docs is False


def test_swagger_dependencies_installed() -> None:
assert SwaggerInstrument.dependencies_installed() is True
15 changes: 1 addition & 14 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import dataclasses
import warnings

import pytest

from lite_bootstrap import FastAPIConfig, FastStreamConfig, FreeConfig, LitestarConfig
from lite_bootstrap import FastAPIConfig
from lite_bootstrap.exceptions import ConfigurationError
from lite_bootstrap.instruments.base import BaseConfig
from tests.conftest import CustomInstrumentor
Expand Down Expand Up @@ -96,18 +95,6 @@ def test_from_dict_explicit_none_overrides_default() -> None:
assert config.service_debug is None


@pytest.mark.parametrize("config_cls", [FreeConfig, LitestarConfig, FastStreamConfig, FastAPIConfig])
def test_otel_insecure_warning_fires_through_config_cascade(config_cls: type) -> None:
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
config_cls(
opentelemetry_endpoint="http://collector.example.com:4317",
opentelemetry_insecure=True,
)
matching = [w for w in caught if "unencrypted" in str(w.message)]
assert matching, f"{config_cls.__name__}: {[str(w.message) for w in caught]}"


@pytest.mark.parametrize(
("config", "expected_name", "expected_version"),
[
Expand Down
6 changes: 4 additions & 2 deletions tests/test_config_cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ def test_an_insecure_endpoint_warning_names_the_line_that_built_the_config(
"""
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
config_type(opentelemetry_endpoint=_REMOTE_INSECURE_ENDPOINT)
config_type(opentelemetry_endpoint=_REMOTE_INSECURE_ENDPOINT, opentelemetry_insecure=True)

assert [w.filename for w in caught] == [__file__]
assert len(caught) == 1
assert "unencrypted" in str(caught[0].message)
assert caught[0].filename == __file__


@dataclasses.dataclass(kw_only=True, frozen=True)
Expand Down
19 changes: 0 additions & 19 deletions tests/test_fastapi_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,25 +345,6 @@ def test_user_supplied_app_keeps_title_version_debug() -> None:
assert user_app.debug is False


def test_fastapi_config_inherits_otel_insecure_warning() -> None:
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
FastAPIConfig(
opentelemetry_endpoint="http://collector.example.com:4317",
opentelemetry_insecure=True,
)
matching = [w for w in caught if "unencrypted" in str(w.message)]
assert matching, [str(w.message) for w in caught]


def test_fastapi_bootstrap_after_teardown_raises() -> None:
bootstrapper = FastAPIBootstrapper(bootstrap_config=FastAPIConfig())
bootstrapper.bootstrap()
bootstrapper.teardown()
with pytest.raises(ConfigurationError, match="construct a new FastAPIBootstrapper"):
bootstrapper.bootstrap()


def test_second_fastapi_bootstrapper_bootstrap_raises(fastapi_config: FastAPIConfig) -> None:
application = fastapi.FastAPI()
first = FastAPIBootstrapper(bootstrap_config=dataclasses.replace(fastapi_config, application=application))
Expand Down
8 changes: 0 additions & 8 deletions tests/test_fastmcp_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,6 @@ def test_fastmcp_bootstrap_without_structlog() -> None:
bootstrapper.teardown()


def test_fastmcp_bootstrap_after_teardown_raises() -> None:
bootstrapper = FastMcpBootstrapper(bootstrap_config=FastMcpConfig())
bootstrapper.bootstrap()
bootstrapper.teardown()
with pytest.raises(ConfigurationError, match="construct a new FastMcpBootstrapper"):
bootstrapper.bootstrap()


def test_second_fastmcp_bootstrapper_bootstrap_raises() -> None:
application = FastMCP()
first = FastMcpBootstrapper(bootstrap_config=FastMcpConfig(application=application, service_name="a"))
Expand Down
8 changes: 0 additions & 8 deletions tests/test_faststream_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,14 +766,6 @@ def _raise_on_write(_self: object, _value: object) -> None:
structlog.get_logger("verify-reset")


def test_faststream_bootstrap_after_teardown_raises() -> None:
bootstrapper = FastStreamBootstrapper(bootstrap_config=FastStreamConfig())
bootstrapper.bootstrap()
bootstrapper.teardown()
with pytest.raises(ConfigurationError, match="construct a new FastStreamBootstrapper"):
bootstrapper.bootstrap()


def test_second_faststream_bootstrapper_bootstrap_raises(broker: RedisBroker) -> None:
config_a = build_faststream_config(broker=broker)
first = FastStreamBootstrapper(bootstrap_config=config_a)
Expand Down
8 changes: 0 additions & 8 deletions tests/test_litestar_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ def test_litestar_bootstrap_twice_returns_the_same_application() -> None:
assert bootstrapper.bootstrap() is bootstrapper.bootstrap()


def test_litestar_bootstrap_after_teardown_raises() -> None:
bootstrapper = LitestarBootstrapper(bootstrap_config=LitestarConfig())
bootstrapper.bootstrap()
bootstrapper.teardown()
with pytest.raises(ConfigurationError, match="construct a new LitestarBootstrapper"):
bootstrapper.bootstrap()


def test_litestar_bootstrapper_not_ready() -> None:
with emulate_package_missing("litestar"), pytest.raises(RuntimeError, match="litestar is not installed"):
LitestarBootstrapper(bootstrap_config=LitestarConfig())
Expand Down
Loading