fastapi-testing 0.3.2__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ from typing import TYPE_CHECKING
2
+
1
3
  from fastapi_testing.async_fastapi_testing import (
2
4
  AsyncTestClient,
3
5
  AsyncTestResponse,
@@ -5,13 +7,20 @@ from fastapi_testing.async_fastapi_testing import (
5
7
  Config,
6
8
  InvalidResponseTypeError,
7
9
  PortGenerator,
10
+ ServerShutdownError,
11
+ ServerStartupError,
8
12
  UvicornTestServer,
9
13
  WebSocketConfig,
10
14
  WebSocketHelper,
11
15
  create_test_server,
12
- global_config,
16
+ get_config,
17
+ set_config,
13
18
  )
14
19
 
20
+ if TYPE_CHECKING:
21
+ # For type checkers only; at runtime __getattr__ below serves the live value.
22
+ from fastapi_testing.async_fastapi_testing import global_config
23
+
15
24
  __all__ = [
16
25
  "AsyncTestClient",
17
26
  "AsyncTestResponse",
@@ -19,9 +28,21 @@ __all__ = [
19
28
  "Config",
20
29
  "InvalidResponseTypeError",
21
30
  "PortGenerator",
31
+ "ServerShutdownError",
32
+ "ServerStartupError",
22
33
  "UvicornTestServer",
23
34
  "WebSocketConfig",
24
35
  "WebSocketHelper",
25
36
  "create_test_server",
37
+ "get_config",
26
38
  "global_config",
39
+ "set_config",
27
40
  ]
41
+
42
+
43
+ def __getattr__(name: str) -> object:
44
+ # ``global_config`` is resolved on access so that it reflects set_config();
45
+ # a plain re-export would keep returning the config active at import time.
46
+ if name == "global_config":
47
+ return get_config()
48
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")