sqlalchemy-pytest 0.1.0__tar.gz → 0.2.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlalchemy-pytest
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  License: MIT
5
5
  Author-email: Doctor <thirvondukr@gmail.com>
6
6
  Requires-Python: >=3.10
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sqlalchemy-pytest"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = ""
5
5
  authors = [
6
6
  { name = "Doctor", email = "thirvondukr@gmail.com" },
@@ -71,7 +71,7 @@ precision = 2
71
71
 
72
72
  [tool.commitizen]
73
73
  name = "cz_conventional_commits"
74
- version = "0.1.0"
74
+ version = "0.2.0"
75
75
  tag_format = "$version"
76
76
  version_files = [
77
77
  "sqlalchemy_pytest/__init__.py",
@@ -79,8 +79,8 @@ version_files = [
79
79
  ]
80
80
 
81
81
  [tool.mypy]
82
- follow_imports = "silent"
83
- ignore_missing_imports = true
82
+ follow_imports = "normal"
83
+ ignore_missing_imports = false
84
84
  check_untyped_defs = true
85
85
  disallow_untyped_calls = true
86
86
  disallow_untyped_defs = true
@@ -0,0 +1 @@
1
+ __version__ = "0.2.0"
@@ -73,8 +73,10 @@ async def _sqlalchemy_create_database(
73
73
 
74
74
 
75
75
  @pytest.fixture(scope="session")
76
- def sqlalchemy_pytest_engine(sqlalchemy_pytest_database_url: str) -> AsyncEngine:
77
- return create_async_engine(sqlalchemy_pytest_database_url)
76
+ async def sqlalchemy_pytest_engine(sqlalchemy_pytest_database_url: str) -> AsyncEngine:
77
+ engine = create_async_engine(sqlalchemy_pytest_database_url)
78
+ yield engine
79
+ await engine.dispose()
78
80
 
79
81
 
80
82
  @pytest.fixture(scope="session")
@@ -106,7 +108,7 @@ async def _sqlalchemy_run_migrations(
106
108
  await conn.commit()
107
109
 
108
110
 
109
- @pytest.fixture(autouse=True)
111
+ @pytest.fixture
110
112
  async def session(
111
113
  _sqlalchemy_run_migrations: None,
112
114
  sqlalchemy_pytest_engine: AsyncEngine,
@@ -0,0 +1,9 @@
1
+ import pytest
2
+ from sqlalchemy import text
3
+ from sqlalchemy.ext.asyncio import AsyncSession
4
+
5
+ pytestmark = [pytest.mark.anyio]
6
+
7
+
8
+ async def test(session: AsyncSession) -> None:
9
+ await session.execute(text("select 1"))
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"
@@ -1,7 +0,0 @@
1
- import pytest
2
-
3
- pytestmark = [pytest.mark.anyio]
4
-
5
-
6
- async def test() -> None:
7
- pass