fastapi-async-sqlalchemy 0.7.1.post1__tar.gz → 0.7.1.post2__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.
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/PKG-INFO +1 -1
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy/__init__.py +1 -1
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy.egg-info/PKG-INFO +1 -1
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy.egg-info/SOURCES.txt +1 -0
- fastapi_async_sqlalchemy-0.7.1.post2/tests/test_import_without_sqlmodel.py +57 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/LICENSE +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/README.md +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy/exceptions.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy/middleware.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy/py.typed +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy.egg-info/dependency_links.txt +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy.egg-info/not-zip-safe +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy.egg-info/requires.txt +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/fastapi_async_sqlalchemy.egg-info/top_level.txt +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/pyproject.toml +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/setup.cfg +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/setup.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_additional_coverage.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_coverage_boost.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_coverage_improvements.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_custom_engine_branch.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_edge_cases_coverage.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_import_fallback_simulation.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_import_fallbacks.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_maximum_coverage.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_multi_sessions_cleanup.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_multisession_pool.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_session.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_sqlmodel.py +0 -0
- {fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_type_hints_compatibility.py +0 -0
|
@@ -19,6 +19,7 @@ tests/test_custom_engine_branch.py
|
|
|
19
19
|
tests/test_edge_cases_coverage.py
|
|
20
20
|
tests/test_import_fallback_simulation.py
|
|
21
21
|
tests/test_import_fallbacks.py
|
|
22
|
+
tests/test_import_without_sqlmodel.py
|
|
22
23
|
tests/test_maximum_coverage.py
|
|
23
24
|
tests/test_multi_sessions_cleanup.py
|
|
24
25
|
tests/test_multisession_pool.py
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test import fallback when SQLModel is not available.
|
|
3
|
+
|
|
4
|
+
This test uses sys.meta_path to block SQLModel imports.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import importlib.abc
|
|
8
|
+
import importlib.machinery
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BlockSQLModelFinder(importlib.abc.MetaPathFinder):
|
|
13
|
+
"""Meta path finder that blocks sqlmodel imports."""
|
|
14
|
+
|
|
15
|
+
def find_spec(self, fullname, path, target=None):
|
|
16
|
+
if "sqlmodel" in fullname:
|
|
17
|
+
raise ImportError(f"No module named '{fullname}'")
|
|
18
|
+
return None # Let other finders handle this
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_sqlmodel_import_fallback():
|
|
22
|
+
"""Test that middleware works without SQLModel installed."""
|
|
23
|
+
# Save current state
|
|
24
|
+
saved_modules = {}
|
|
25
|
+
for key in list(sys.modules.keys()):
|
|
26
|
+
if key.startswith("sqlmodel") or key == "fastapi_async_sqlalchemy.middleware":
|
|
27
|
+
saved_modules[key] = sys.modules.pop(key, None)
|
|
28
|
+
|
|
29
|
+
# Install the import blocker
|
|
30
|
+
blocker = BlockSQLModelFinder()
|
|
31
|
+
sys.meta_path.insert(0, blocker)
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
# Import middleware fresh - this should trigger the ImportError path for SQLModel
|
|
35
|
+
# Verify that DefaultAsyncSession falls back to plain AsyncSession
|
|
36
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
37
|
+
|
|
38
|
+
import fastapi_async_sqlalchemy.middleware as middleware
|
|
39
|
+
|
|
40
|
+
assert middleware.DefaultAsyncSession is AsyncSession, (
|
|
41
|
+
"Expected DefaultAsyncSession to be AsyncSession when SQLModel is not available"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
finally:
|
|
45
|
+
# Remove the blocker
|
|
46
|
+
sys.meta_path.remove(blocker)
|
|
47
|
+
|
|
48
|
+
# Clean up imported module
|
|
49
|
+
sys.modules.pop("fastapi_async_sqlalchemy.middleware", None)
|
|
50
|
+
sys.modules.pop("fastapi_async_sqlalchemy", None)
|
|
51
|
+
|
|
52
|
+
# Restore saved modules
|
|
53
|
+
for key, value in saved_modules.items():
|
|
54
|
+
if value is not None:
|
|
55
|
+
sys.modules[key] = value
|
|
56
|
+
|
|
57
|
+
# Re-import to restore normal state
|
|
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
|
{fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/pyproject.toml
RENAMED
|
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
|
{fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_session.py
RENAMED
|
File without changes
|
{fastapi_async_sqlalchemy-0.7.1.post1 → fastapi_async_sqlalchemy-0.7.1.post2}/tests/test_sqlmodel.py
RENAMED
|
File without changes
|
|
File without changes
|