diff --git a/tests/instruments/test_cors_instrument.py b/tests/instruments/test_cors_instrument.py index 2ca22ae..baccfb6 100644 --- a/tests/instruments/test_cors_instrument.py +++ b/tests/instruments/test_cors_instrument.py @@ -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"), [ diff --git a/tests/instruments/test_healthchecks_instrument.py b/tests/instruments/test_healthchecks_instrument.py index 9491cce..157651d 100644 --- a/tests/instruments/test_healthchecks_instrument.py +++ b/tests/instruments/test_healthchecks_instrument.py @@ -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 diff --git a/tests/instruments/test_swagger_instrument.py b/tests/instruments/test_swagger_instrument.py index bc40e5a..f2879e4 100644 --- a/tests/instruments/test_swagger_instrument.py +++ b/tests/instruments/test_swagger_instrument.py @@ -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 diff --git a/tests/test_config.py b/tests/test_config.py index 163e2bc..e061ce7 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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 @@ -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"), [ diff --git a/tests/test_config_cascade.py b/tests/test_config_cascade.py index dbcf618..a40083b 100644 --- a/tests/test_config_cascade.py +++ b/tests/test_config_cascade.py @@ -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) diff --git a/tests/test_fastapi_bootstrap.py b/tests/test_fastapi_bootstrap.py index 53c1416..a607fa0 100644 --- a/tests/test_fastapi_bootstrap.py +++ b/tests/test_fastapi_bootstrap.py @@ -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)) diff --git a/tests/test_fastmcp_bootstrap.py b/tests/test_fastmcp_bootstrap.py index 18b482f..ba1dc15 100644 --- a/tests/test_fastmcp_bootstrap.py +++ b/tests/test_fastmcp_bootstrap.py @@ -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")) diff --git a/tests/test_faststream_bootstrap.py b/tests/test_faststream_bootstrap.py index d22c029..46721b5 100644 --- a/tests/test_faststream_bootstrap.py +++ b/tests/test_faststream_bootstrap.py @@ -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) diff --git a/tests/test_litestar_bootstrap.py b/tests/test_litestar_bootstrap.py index dceb9dc..f213282 100644 --- a/tests/test_litestar_bootstrap.py +++ b/tests/test_litestar_bootstrap.py @@ -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())