Skip to content

Commit c069e70

Browse files
authored
test: remove 12 redundant cases (#445)
1 parent 4d2bd1e commit c069e70

9 files changed

Lines changed: 5 additions & 71 deletions

‎tests/instruments/test_cors_instrument.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ def test_cors_instrument_config_defaults() -> None:
4040
assert config.cors_max_age == expected_max_age
4141

4242

43-
def test_cors_dependencies_installed() -> None:
44-
assert CorsInstrument.dependencies_installed() is True
45-
46-
4743
@pytest.mark.parametrize(
4844
("origins", "regex"),
4945
[

‎tests/instruments/test_healthchecks_instrument.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ def test_healthchecks_config_defaults() -> None:
5151
assert config.health_checks_probes == {}
5252

5353

54-
def test_healthchecks_dependencies_installed() -> None:
55-
assert HealthChecksInstrument.dependencies_installed() is True
56-
57-
5854
async def test_healthchecks_probes_run_concurrently() -> None:
5955
interval = 0.2
6056

‎tests/instruments/test_swagger_instrument.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@ def test_swagger_config_defaults() -> None:
1111
assert config.swagger_static_path == "/static"
1212
assert config.swagger_path == "/docs"
1313
assert config.swagger_offline_docs is False
14-
15-
16-
def test_swagger_dependencies_installed() -> None:
17-
assert SwaggerInstrument.dependencies_installed() is True

‎tests/test_config.py‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import dataclasses
2-
import warnings
32

43
import pytest
54

6-
from lite_bootstrap import FastAPIConfig, FastStreamConfig, FreeConfig, LitestarConfig
5+
from lite_bootstrap import FastAPIConfig
76
from lite_bootstrap.exceptions import ConfigurationError
87
from lite_bootstrap.instruments.base import BaseConfig
98
from tests.conftest import CustomInstrumentor
@@ -96,18 +95,6 @@ def test_from_dict_explicit_none_overrides_default() -> None:
9695
assert config.service_debug is None
9796

9897

99-
@pytest.mark.parametrize("config_cls", [FreeConfig, LitestarConfig, FastStreamConfig, FastAPIConfig])
100-
def test_otel_insecure_warning_fires_through_config_cascade(config_cls: type) -> None:
101-
with warnings.catch_warnings(record=True) as caught:
102-
warnings.simplefilter("always")
103-
config_cls(
104-
opentelemetry_endpoint="http://collector.example.com:4317",
105-
opentelemetry_insecure=True,
106-
)
107-
matching = [w for w in caught if "unencrypted" in str(w.message)]
108-
assert matching, f"{config_cls.__name__}: {[str(w.message) for w in caught]}"
109-
110-
11198
@pytest.mark.parametrize(
11299
("config", "expected_name", "expected_version"),
113100
[

‎tests/test_config_cascade.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ def test_an_insecure_endpoint_warning_names_the_line_that_built_the_config(
7272
"""
7373
with warnings.catch_warnings(record=True) as caught:
7474
warnings.simplefilter("always")
75-
config_type(opentelemetry_endpoint=_REMOTE_INSECURE_ENDPOINT)
75+
config_type(opentelemetry_endpoint=_REMOTE_INSECURE_ENDPOINT, opentelemetry_insecure=True)
7676

77-
assert [w.filename for w in caught] == [__file__]
77+
assert len(caught) == 1
78+
assert "unencrypted" in str(caught[0].message)
79+
assert caught[0].filename == __file__
7880

7981

8082
@dataclasses.dataclass(kw_only=True, frozen=True)

‎tests/test_fastapi_bootstrap.py‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -345,25 +345,6 @@ def test_user_supplied_app_keeps_title_version_debug() -> None:
345345
assert user_app.debug is False
346346

347347

348-
def test_fastapi_config_inherits_otel_insecure_warning() -> None:
349-
with warnings.catch_warnings(record=True) as caught:
350-
warnings.simplefilter("always")
351-
FastAPIConfig(
352-
opentelemetry_endpoint="http://collector.example.com:4317",
353-
opentelemetry_insecure=True,
354-
)
355-
matching = [w for w in caught if "unencrypted" in str(w.message)]
356-
assert matching, [str(w.message) for w in caught]
357-
358-
359-
def test_fastapi_bootstrap_after_teardown_raises() -> None:
360-
bootstrapper = FastAPIBootstrapper(bootstrap_config=FastAPIConfig())
361-
bootstrapper.bootstrap()
362-
bootstrapper.teardown()
363-
with pytest.raises(ConfigurationError, match="construct a new FastAPIBootstrapper"):
364-
bootstrapper.bootstrap()
365-
366-
367348
def test_second_fastapi_bootstrapper_bootstrap_raises(fastapi_config: FastAPIConfig) -> None:
368349
application = fastapi.FastAPI()
369350
first = FastAPIBootstrapper(bootstrap_config=dataclasses.replace(fastapi_config, application=application))

‎tests/test_fastmcp_bootstrap.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,6 @@ def test_fastmcp_bootstrap_without_structlog() -> None:
419419
bootstrapper.teardown()
420420

421421

422-
def test_fastmcp_bootstrap_after_teardown_raises() -> None:
423-
bootstrapper = FastMcpBootstrapper(bootstrap_config=FastMcpConfig())
424-
bootstrapper.bootstrap()
425-
bootstrapper.teardown()
426-
with pytest.raises(ConfigurationError, match="construct a new FastMcpBootstrapper"):
427-
bootstrapper.bootstrap()
428-
429-
430422
def test_second_fastmcp_bootstrapper_bootstrap_raises() -> None:
431423
application = FastMCP()
432424
first = FastMcpBootstrapper(bootstrap_config=FastMcpConfig(application=application, service_name="a"))

‎tests/test_faststream_bootstrap.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -766,14 +766,6 @@ def _raise_on_write(_self: object, _value: object) -> None:
766766
structlog.get_logger("verify-reset")
767767

768768

769-
def test_faststream_bootstrap_after_teardown_raises() -> None:
770-
bootstrapper = FastStreamBootstrapper(bootstrap_config=FastStreamConfig())
771-
bootstrapper.bootstrap()
772-
bootstrapper.teardown()
773-
with pytest.raises(ConfigurationError, match="construct a new FastStreamBootstrapper"):
774-
bootstrapper.bootstrap()
775-
776-
777769
def test_second_faststream_bootstrapper_bootstrap_raises(broker: RedisBroker) -> None:
778770
config_a = build_faststream_config(broker=broker)
779771
first = FastStreamBootstrapper(bootstrap_config=config_a)

‎tests/test_litestar_bootstrap.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,6 @@ def test_litestar_bootstrap_twice_returns_the_same_application() -> None:
149149
assert bootstrapper.bootstrap() is bootstrapper.bootstrap()
150150

151151

152-
def test_litestar_bootstrap_after_teardown_raises() -> None:
153-
bootstrapper = LitestarBootstrapper(bootstrap_config=LitestarConfig())
154-
bootstrapper.bootstrap()
155-
bootstrapper.teardown()
156-
with pytest.raises(ConfigurationError, match="construct a new LitestarBootstrapper"):
157-
bootstrapper.bootstrap()
158-
159-
160152
def test_litestar_bootstrapper_not_ready() -> None:
161153
with emulate_package_missing("litestar"), pytest.raises(RuntimeError, match="litestar is not installed"):
162154
LitestarBootstrapper(bootstrap_config=LitestarConfig())

0 commit comments

Comments
 (0)