assertical 0.3.1__tar.gz → 0.3.2__tar.gz

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.
Files changed (29) hide show
  1. {assertical-0.3.1/src/assertical.egg-info → assertical-0.3.2}/PKG-INFO +1 -1
  2. {assertical-0.3.1 → assertical-0.3.2}/pyproject.toml +1 -1
  3. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fake/generator.py +5 -3
  4. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fixtures/fastapi.py +7 -7
  5. {assertical-0.3.1 → assertical-0.3.2/src/assertical.egg-info}/PKG-INFO +1 -1
  6. {assertical-0.3.1 → assertical-0.3.2}/LICENSE.txt +0 -0
  7. {assertical-0.3.1 → assertical-0.3.2}/README.md +0 -0
  8. {assertical-0.3.1 → assertical-0.3.2}/setup.cfg +0 -0
  9. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/__init__.py +0 -0
  10. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/asserts/__init__.py +0 -0
  11. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/asserts/generator.py +0 -0
  12. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/asserts/pandas.py +0 -0
  13. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/asserts/time.py +0 -0
  14. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/asserts/type.py +0 -0
  15. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fake/__init__.py +0 -0
  16. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fake/asyncio.py +0 -0
  17. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fake/http.py +0 -0
  18. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fake/sqlalchemy.py +0 -0
  19. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fixtures/__init__.py +0 -0
  20. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fixtures/environment.py +0 -0
  21. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fixtures/generator.py +0 -0
  22. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/fixtures/postgres.py +0 -0
  23. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/py.typed +0 -0
  24. {assertical-0.3.1 → assertical-0.3.2}/src/assertical/snapshot.py +0 -0
  25. {assertical-0.3.1 → assertical-0.3.2}/src/assertical.egg-info/SOURCES.txt +0 -0
  26. {assertical-0.3.1 → assertical-0.3.2}/src/assertical.egg-info/dependency_links.txt +0 -0
  27. {assertical-0.3.1 → assertical-0.3.2}/src/assertical.egg-info/requires.txt +0 -0
  28. {assertical-0.3.1 → assertical-0.3.2}/src/assertical.egg-info/top_level.txt +0 -0
  29. {assertical-0.3.1 → assertical-0.3.2}/tests/test_snapshot.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: assertical
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Assertical - a modular library for helping write (async) integration/unit tests for fastapi/sqlalchemy/postgres projects
5
5
  Author: Battery Storage and Grid Integration Program
6
6
  Project-URL: Homepage, https://github.com/bsgip/assertical
@@ -30,7 +30,7 @@ build-backend = "setuptools.build_meta"
30
30
 
31
31
  [project]
32
32
  name = "assertical"
33
- version = "0.3.1"
33
+ version = "0.3.2"
34
34
  description = "Assertical - a modular library for helping write (async) integration/unit tests for fastapi/sqlalchemy/postgres projects"
35
35
  authors = [{ name = "Battery Storage and Grid Integration Program" }]
36
36
  readme = "README.md"
@@ -350,10 +350,10 @@ def enumerate_class_properties(t: type) -> Generator[PropertyGenerationDetails,
350
350
  # Currently we're digging around in the guts of the Base registry - there maybe an official way to do this?
351
351
  if t_generatable_base == DeclarativeBase:
352
352
  if isinstance(member_type, str):
353
- member_type = t.registry._class_registry[member_type] # type: ignore
353
+ member_type = t.registry._class_registry[member_type]
354
354
  if t_generatable_base == DeclarativeBaseNoMeta:
355
355
  if isinstance(member_type, str):
356
- member_type = t.registry._class_registry[member_type] # type: ignore
356
+ member_type = t.registry._class_registry[member_type]
357
357
 
358
358
  if is_generatable_type(member_type):
359
359
  type_to_generate = get_first_generatable_primitive(member_type, include_optional=False)
@@ -651,7 +651,9 @@ def register_base_type(
651
651
 
652
652
  # Base type registration
653
653
  register_base_type(
654
- _PlaceholderDataclassBase, DEFAULT_CLASS_INSTANCE_GENERATOR, lambda target: [f.name for f in fields(target)]
654
+ _PlaceholderDataclassBase,
655
+ DEFAULT_CLASS_INSTANCE_GENERATOR,
656
+ lambda target: [f.name for f in fields(target) if f.init],
655
657
  )
656
658
 
657
659
  if "pydantic_xml" in sys.modules:
@@ -1,6 +1,6 @@
1
1
  import asyncio
2
2
  from contextlib import asynccontextmanager
3
- from typing import AsyncGenerator, Optional
3
+ from typing import Any, AsyncGenerator, Awaitable, Optional
4
4
 
5
5
  import uvicorn
6
6
  from asgi_lifespan import LifespanManager
@@ -24,12 +24,11 @@ class UvicornTestServer(uvicorn.Server):
24
24
  port (int, optional): the port. Defaults to PORT.
25
25
  """
26
26
  self._startup_done = asyncio.Event()
27
- super().__init__(config=uvicorn.Config(app, host=host, port=port))
27
+ self._serve_task: Optional[Awaitable[Any]] = None
28
+ super().__init__(config=uvicorn.Config(app, host=host, port=port, loop="asyncio"))
28
29
 
29
- async def startup(self, sockets: Optional[list] = None) -> None:
30
- """Override uvicorn startup"""
30
+ async def startup(self, sockets: Optional[list[Any]] = None) -> None:
31
31
  await super().startup(sockets=sockets)
32
- self.config.setup_event_loop()
33
32
  self._startup_done.set()
34
33
 
35
34
  async def up(self) -> None:
@@ -38,7 +37,8 @@ class UvicornTestServer(uvicorn.Server):
38
37
 
39
38
  async def down(self) -> None:
40
39
  self.should_exit = True
41
- await self._serve_task
40
+ if self._serve_task:
41
+ await self._serve_task
42
42
 
43
43
 
44
44
  @asynccontextmanager
@@ -83,7 +83,7 @@ async def start_uvicorn_server(app: FastAPI, host: str = "127.0.0.1", port: int
83
83
  # Extract the listening socket - this isn't the most robust method but haven't found a counterexample yet
84
84
  if not server.servers or not server.servers[0].sockets:
85
85
  raise Exception("Unable to find listening socket")
86
- (host, port) = server.servers[0].sockets[0].getsockname()
86
+ host, port = server.servers[0].sockets[0].getsockname()
87
87
  yield f"http://{host}:{port}"
88
88
 
89
89
  await server.down()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: assertical
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Assertical - a modular library for helping write (async) integration/unit tests for fastapi/sqlalchemy/postgres projects
5
5
  Author: Battery Storage and Grid Integration Program
6
6
  Project-URL: Homepage, https://github.com/bsgip/assertical
File without changes
File without changes
File without changes