sqlakit 0.8.0__tar.gz → 0.8.1__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 (27) hide show
  1. {sqlakit-0.8.0 → sqlakit-0.8.1}/PKG-INFO +1 -1
  2. {sqlakit-0.8.0 → sqlakit-0.8.1}/pyproject.toml +1 -1
  3. {sqlakit-0.8.0 → sqlakit-0.8.1}/pyproject.toml.orig +1 -1
  4. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/pytest_plugin.py +17 -1
  5. {sqlakit-0.8.0 → sqlakit-0.8.1}/LICENSE +0 -0
  6. {sqlakit-0.8.0 → sqlakit-0.8.1}/README.md +0 -0
  7. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/__init__.py +0 -0
  8. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_base.py +0 -0
  9. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_db.py +0 -0
  10. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_discovery.py +0 -0
  11. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_model.py +0 -0
  12. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_query.py +0 -0
  13. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_recording.py +0 -0
  14. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_registry.py +0 -0
  15. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_routing.py +0 -0
  16. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/_sql.py +0 -0
  17. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/asyncio/__init__.py +0 -0
  18. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/asyncio/_db.py +0 -0
  19. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/asyncio/_registry.py +0 -0
  20. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/asyncio/orm.py +0 -0
  21. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/asyncio/sql.py +0 -0
  22. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/exceptions.py +0 -0
  23. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/orm.py +0 -0
  24. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/py.typed +0 -0
  25. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/sql.py +0 -0
  26. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/testing.py +0 -0
  27. {sqlakit-0.8.0 → sqlakit-0.8.1}/sqlakit/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlakit
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: A toolkit for SQLAlchemy applications.
5
5
  Keywords: sqlalchemy,database,orm,sql,asyncio
6
6
  Author: Anton Ruhlov
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sqlakit"
3
- version = "0.8.0"
3
+ version = "0.8.1"
4
4
  description = "A toolkit for SQLAlchemy applications."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sqlakit"
3
- version = "0.8.0"
3
+ version = "0.8.1"
4
4
  description = "A toolkit for SQLAlchemy applications."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -85,7 +85,23 @@ def pytest_collection_modifyitems(
85
85
  if item.get_closest_marker(MARKER) is None:
86
86
  continue
87
87
  awaited = inspect.iscoroutinefunction(item.function)
88
- item.fixturenames.append(ASYNC_FIXTURE if awaited else SYNC_FIXTURE)
88
+ name = ASYNC_FIXTURE if awaited else SYNC_FIXTURE
89
+ item.fixturenames.insert(_before_the_test_s_own(item), name)
90
+
91
+
92
+ def _before_the_test_s_own(item: pytest.Function) -> int:
93
+ """Return where the transaction goes among the fixtures of a test.
94
+
95
+ `fixturenames` is the order they set up in. A fixture of the test's own
96
+ that writes has to run inside the transaction, and one of a wider scope,
97
+ the schema or a module that seeds itself, has to run outside it.
98
+ """
99
+ known = item._fixtureinfo.name2fixturedefs # noqa: SLF001
100
+ for index, name in enumerate(item.fixturenames):
101
+ defined = known.get(name)
102
+ if defined and defined[-1].scope == "function":
103
+ return index
104
+ return len(item.fixturenames)
89
105
 
90
106
 
91
107
  @pytest.fixture(scope="session")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes