pytest-postgresql 9.1.1__tar.gz → 10.0.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.
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/CHANGES.rst +23 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/PKG-INFO +5 -5
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pyproject.toml +16 -13
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pyproject.toml.orig +16 -13
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/__init__.py +1 -2
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/exceptions.py +1 -1
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/executors/proc.py +7 -7
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/client.py +2 -1
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/noprocess.py +1 -1
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/process.py +1 -1
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/janitor.py +8 -7
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/loader.py +3 -2
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/retry.py +5 -4
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/COPYING.lesser +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/README.rst +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/_asyncio_compat.py +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/config.py +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/executors/__init__.py +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/executors/noop.py +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/__init__.py +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/_pg.py +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/plugin.py +0 -0
- {pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/py.typed +0 -0
|
@@ -3,6 +3,29 @@ CHANGELOG
|
|
|
3
3
|
|
|
4
4
|
.. towncrier release notes start
|
|
5
5
|
|
|
6
|
+
pytest-postgresql 10.0.0 (2026-11-04)
|
|
7
|
+
=====================================
|
|
8
|
+
|
|
9
|
+
Breaking changes
|
|
10
|
+
----------------
|
|
11
|
+
|
|
12
|
+
- Require pytest>=8.4, the lowest version compatible with the ``async`` extra (pytest-asyncio>=1.4).
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Features
|
|
16
|
+
--------
|
|
17
|
+
|
|
18
|
+
- Add support for Python 3.15, drop support for Python 3.10 (`#1440 <https://github.com/dbfixtures/pytest-postgresql/issues/1440>`__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Miscellaneous
|
|
22
|
+
-------------
|
|
23
|
+
|
|
24
|
+
- Freeze all pre-commit hook revisions to commit SHAs. (`#1441 <https://github.com/dbfixtures/pytest-postgresql/issues/1441>`__)
|
|
25
|
+
- Enable UP and PYI ruff rulesets (`#1444 <https://github.com/dbfixtures/pytest-postgresql/issues/1444>`__)
|
|
26
|
+
- Run docker and async-extra-less tests as steps of the regular test jobs, split test workflows per OS (`#1476 <https://github.com/dbfixtures/pytest-postgresql/issues/1476>`__)
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
pytest-postgresql 9.1.1 (2026-10-04)
|
|
7
30
|
====================================
|
|
8
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-postgresql
|
|
3
|
-
Version:
|
|
3
|
+
Version: 10.0.0
|
|
4
4
|
Summary: Postgresql fixtures and fixture factories for Pytest.
|
|
5
5
|
Keywords: fixture,postgresql,pytest,tests
|
|
6
6
|
Author: Grzegorz Śliwiński
|
|
@@ -16,24 +16,24 @@ Classifier: Operating System :: OS Independent
|
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
24
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
25
|
Classifier: Topic :: Software Development :: Testing
|
|
26
26
|
Requires-Dist: mirakuru>=2.6.0
|
|
27
27
|
Requires-Dist: packaging
|
|
28
28
|
Requires-Dist: port-for>=0.7.3
|
|
29
29
|
Requires-Dist: psycopg>=3.0.0
|
|
30
|
-
Requires-Dist: pytest>=8.
|
|
30
|
+
Requires-Dist: pytest>=8.4
|
|
31
31
|
Requires-Dist: aiofiles>=23.0 ; extra == 'async'
|
|
32
32
|
Requires-Dist: pytest-asyncio>=1.4 ; extra == 'async'
|
|
33
|
-
Requires-Python: >=3.
|
|
33
|
+
Requires-Python: >=3.11
|
|
34
34
|
Project-URL: Source, https://github.com/dbfixtures/pytest-postgresql
|
|
35
35
|
Project-URL: Bug Tracker, https://github.com/dbfixtures/pytest-postgresql/issues
|
|
36
|
-
Project-URL: Changelog, https://github.com/dbfixtures/pytest-postgresql/blob/
|
|
36
|
+
Project-URL: Changelog, https://github.com/dbfixtures/pytest-postgresql/blob/v10.0.0/CHANGES.rst
|
|
37
37
|
Provides-Extra: async
|
|
38
38
|
Description-Content-Type: text/x-rst
|
|
39
39
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
build-backend = "uv_build"
|
|
3
|
-
requires = ["uv-build>=0.11,<0.
|
|
3
|
+
requires = ["uv-build>=0.11,<0.14"]
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pytest-postgresql"
|
|
7
|
-
version = "
|
|
7
|
+
version = "10.0.0"
|
|
8
8
|
description = "Postgresql fixtures and fixture factories for Pytest."
|
|
9
9
|
readme = "README.rst"
|
|
10
10
|
keywords = [
|
|
@@ -15,7 +15,7 @@ keywords = [
|
|
|
15
15
|
]
|
|
16
16
|
license = "LGPL-3.0-or-later"
|
|
17
17
|
license-files = ["COPYING.lesser"]
|
|
18
|
-
requires-python = ">=3.
|
|
18
|
+
requires-python = ">=3.11"
|
|
19
19
|
classifiers = [
|
|
20
20
|
"Development Status :: 5 - Production/Stable",
|
|
21
21
|
"Environment :: Web Environment",
|
|
@@ -26,11 +26,11 @@ classifiers = [
|
|
|
26
26
|
"Programming Language :: Python",
|
|
27
27
|
"Programming Language :: Python :: 3",
|
|
28
28
|
"Programming Language :: Python :: 3 :: Only",
|
|
29
|
-
"Programming Language :: Python :: 3.10",
|
|
30
29
|
"Programming Language :: Python :: 3.11",
|
|
31
30
|
"Programming Language :: Python :: 3.12",
|
|
32
31
|
"Programming Language :: Python :: 3.13",
|
|
33
32
|
"Programming Language :: Python :: 3.14",
|
|
33
|
+
"Programming Language :: Python :: 3.15",
|
|
34
34
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
35
|
"Topic :: Software Development :: Testing",
|
|
36
36
|
]
|
|
@@ -39,7 +39,7 @@ dependencies = [
|
|
|
39
39
|
"packaging",
|
|
40
40
|
"port-for>=0.7.3",
|
|
41
41
|
"psycopg>=3.0.0",
|
|
42
|
-
"pytest>=8.
|
|
42
|
+
"pytest>=8.4",
|
|
43
43
|
]
|
|
44
44
|
|
|
45
45
|
[[project.authors]]
|
|
@@ -55,7 +55,7 @@ async = [
|
|
|
55
55
|
[project.urls]
|
|
56
56
|
Source = "https://github.com/dbfixtures/pytest-postgresql"
|
|
57
57
|
"Bug Tracker" = "https://github.com/dbfixtures/pytest-postgresql/issues"
|
|
58
|
-
Changelog = "https://github.com/dbfixtures/pytest-postgresql/blob/
|
|
58
|
+
Changelog = "https://github.com/dbfixtures/pytest-postgresql/blob/v10.0.0/CHANGES.rst"
|
|
59
59
|
|
|
60
60
|
[project.entry-points.pytest11]
|
|
61
61
|
pytest_postgresql = "pytest_postgresql.plugin"
|
|
@@ -63,16 +63,16 @@ pytest_postgresql = "pytest_postgresql.plugin"
|
|
|
63
63
|
[dependency-groups]
|
|
64
64
|
dev = [
|
|
65
65
|
"aiofiles==25.1.0",
|
|
66
|
-
"coverage==7.
|
|
67
|
-
"mirakuru==3.0.
|
|
66
|
+
"coverage==7.17.0",
|
|
67
|
+
"mirakuru==3.0.4",
|
|
68
68
|
"mock==5.2.0",
|
|
69
|
-
"mypy==2.
|
|
69
|
+
"mypy==2.4.0; implementation_name=='cpython'",
|
|
70
70
|
"packaging==26.3",
|
|
71
|
-
"port-for==1.1.
|
|
71
|
+
"port-for==1.1.1",
|
|
72
72
|
"psycopg==3.3.6",
|
|
73
73
|
"psycopg-binary==3.3.6; implementation_name=='cpython' and python_version<'3.15'",
|
|
74
74
|
"pytest==9.1.1",
|
|
75
|
-
"pytest-asyncio==1.4.
|
|
75
|
+
"pytest-asyncio==1.4.1",
|
|
76
76
|
"pytest-xdist==3.8.0",
|
|
77
77
|
"towncrier==26.9.0",
|
|
78
78
|
"types-aiofiles==25.1.0.20260518",
|
|
@@ -85,7 +85,7 @@ module-root = ""
|
|
|
85
85
|
source-include = ["CHANGES.rst"]
|
|
86
86
|
|
|
87
87
|
[tool.ruff]
|
|
88
|
-
target-version = "
|
|
88
|
+
target-version = "py311"
|
|
89
89
|
line-length = 120
|
|
90
90
|
|
|
91
91
|
[tool.ruff.lint]
|
|
@@ -96,6 +96,8 @@ select = [
|
|
|
96
96
|
"FBT",
|
|
97
97
|
"I",
|
|
98
98
|
"PT",
|
|
99
|
+
"PYI",
|
|
100
|
+
"UP",
|
|
99
101
|
]
|
|
100
102
|
|
|
101
103
|
[tool.pyproject-fmt]
|
|
@@ -111,6 +113,7 @@ sub_table_spacing = """
|
|
|
111
113
|
[tool.mypy]
|
|
112
114
|
ignore_missing_imports = false
|
|
113
115
|
follow_imports = "silent"
|
|
116
|
+
python_version = "3.11"
|
|
114
117
|
disallow_subclassing_any = true
|
|
115
118
|
disallow_untyped_calls = true
|
|
116
119
|
disallow_untyped_defs = true
|
|
@@ -163,7 +166,7 @@ message_template = "Release {new_version}"
|
|
|
163
166
|
tag_template = "v{new_version}"
|
|
164
167
|
|
|
165
168
|
[tool.tbump.version]
|
|
166
|
-
current = "
|
|
169
|
+
current = "10.0.0"
|
|
167
170
|
regex = '''
|
|
168
171
|
(?P<major>\d+)
|
|
169
172
|
\.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
build-backend = "uv_build"
|
|
3
|
-
requires = [ "uv-build>=0.11,<0.
|
|
3
|
+
requires = [ "uv-build>=0.11,<0.14" ]
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pytest-postgresql"
|
|
7
|
-
version = "
|
|
7
|
+
version = "10.0.0"
|
|
8
8
|
description = "Postgresql fixtures and fixture factories for Pytest."
|
|
9
9
|
readme = "README.rst"
|
|
10
10
|
keywords = [ "fixture", "postgresql", "pytest", "tests" ]
|
|
11
11
|
license = "LGPL-3.0-or-later"
|
|
12
12
|
license-files = [ "COPYING.lesser" ]
|
|
13
|
-
requires-python = ">=3.
|
|
13
|
+
requires-python = ">=3.11"
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Development Status :: 5 - Production/Stable",
|
|
16
16
|
"Environment :: Web Environment",
|
|
@@ -21,15 +21,15 @@ classifiers = [
|
|
|
21
21
|
"Programming Language :: Python",
|
|
22
22
|
"Programming Language :: Python :: 3",
|
|
23
23
|
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
-
"Programming Language :: Python :: 3.10",
|
|
25
24
|
"Programming Language :: Python :: 3.11",
|
|
26
25
|
"Programming Language :: Python :: 3.12",
|
|
27
26
|
"Programming Language :: Python :: 3.13",
|
|
28
27
|
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Programming Language :: Python :: 3.15",
|
|
29
29
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
30
30
|
"Topic :: Software Development :: Testing",
|
|
31
31
|
]
|
|
32
|
-
dependencies = [ "mirakuru>=2.6.0", "packaging", "port-for>=0.7.3", "psycopg>=3.0.0", "pytest>=8.
|
|
32
|
+
dependencies = [ "mirakuru>=2.6.0", "packaging", "port-for>=0.7.3", "psycopg>=3.0.0", "pytest>=8.4" ]
|
|
33
33
|
|
|
34
34
|
[[project.authors]]
|
|
35
35
|
name = "Grzegorz Śliwiński"
|
|
@@ -41,7 +41,7 @@ async = [ "aiofiles>=23.0", "pytest-asyncio>=1.4" ]
|
|
|
41
41
|
[project.urls]
|
|
42
42
|
Source = "https://github.com/dbfixtures/pytest-postgresql"
|
|
43
43
|
"Bug Tracker" = "https://github.com/dbfixtures/pytest-postgresql/issues"
|
|
44
|
-
Changelog = "https://github.com/dbfixtures/pytest-postgresql/blob/
|
|
44
|
+
Changelog = "https://github.com/dbfixtures/pytest-postgresql/blob/v10.0.0/CHANGES.rst"
|
|
45
45
|
|
|
46
46
|
[project.entry-points.pytest11]
|
|
47
47
|
pytest_postgresql = "pytest_postgresql.plugin"
|
|
@@ -49,16 +49,16 @@ pytest_postgresql = "pytest_postgresql.plugin"
|
|
|
49
49
|
[dependency-groups]
|
|
50
50
|
dev = [
|
|
51
51
|
"aiofiles==25.1.0",
|
|
52
|
-
"coverage==7.
|
|
53
|
-
"mirakuru==3.0.
|
|
52
|
+
"coverage==7.17.0",
|
|
53
|
+
"mirakuru==3.0.4",
|
|
54
54
|
"mock==5.2.0",
|
|
55
|
-
"mypy==2.
|
|
55
|
+
"mypy==2.4.0; implementation_name=='cpython'",
|
|
56
56
|
"packaging==26.3",
|
|
57
|
-
"port-for==1.1.
|
|
57
|
+
"port-for==1.1.1",
|
|
58
58
|
"psycopg==3.3.6",
|
|
59
59
|
"psycopg-binary==3.3.6; implementation_name=='cpython' and python_version<'3.15'",
|
|
60
60
|
"pytest==9.1.1",
|
|
61
|
-
"pytest-asyncio==1.4.
|
|
61
|
+
"pytest-asyncio==1.4.1",
|
|
62
62
|
"pytest-xdist==3.8.0",
|
|
63
63
|
"towncrier==26.9.0",
|
|
64
64
|
"types-aiofiles==25.1.0.20260518",
|
|
@@ -73,7 +73,7 @@ module-root = ""
|
|
|
73
73
|
source-include = [ "CHANGES.rst" ]
|
|
74
74
|
|
|
75
75
|
[tool.ruff]
|
|
76
|
-
target-version = "
|
|
76
|
+
target-version = "py311"
|
|
77
77
|
line-length = 120
|
|
78
78
|
|
|
79
79
|
[tool.ruff.lint]
|
|
@@ -84,6 +84,8 @@ select = [
|
|
|
84
84
|
"FBT", # flake8-boolean-trap
|
|
85
85
|
"I", # isort
|
|
86
86
|
"PT", # flake8-pytest-style
|
|
87
|
+
"PYI", # flake8-pyi
|
|
88
|
+
"UP", # pyupgrade
|
|
87
89
|
]
|
|
88
90
|
|
|
89
91
|
[tool.pyproject-fmt]
|
|
@@ -97,6 +99,7 @@ sub_table_spacing = "\n"
|
|
|
97
99
|
[tool.mypy]
|
|
98
100
|
ignore_missing_imports = false
|
|
99
101
|
follow_imports = "silent"
|
|
102
|
+
python_version = "3.11"
|
|
100
103
|
disallow_subclassing_any = true
|
|
101
104
|
disallow_untyped_calls = true
|
|
102
105
|
disallow_untyped_defs = true
|
|
@@ -146,7 +149,7 @@ message_template = "Release {new_version}"
|
|
|
146
149
|
tag_template = "v{new_version}"
|
|
147
150
|
|
|
148
151
|
[tool.tbump.version]
|
|
149
|
-
current = "
|
|
152
|
+
current = "10.0.0"
|
|
150
153
|
regex = '''
|
|
151
154
|
(?P<major>\d+)
|
|
152
155
|
\.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
1
|
# Copyright (C) 2016 by Clearcode <http://clearcode.cc>
|
|
3
2
|
# and associates (see AUTHORS).
|
|
4
3
|
|
|
@@ -18,4 +17,4 @@
|
|
|
18
17
|
# along with pytest-postgresql. If not, see <http://www.gnu.org/licenses/>.
|
|
19
18
|
"""Main module for pytest-postgresql."""
|
|
20
19
|
|
|
21
|
-
__version__ = "
|
|
20
|
+
__version__ = "10.0.0"
|
|
@@ -28,7 +28,7 @@ import subprocess
|
|
|
28
28
|
import tempfile
|
|
29
29
|
import time
|
|
30
30
|
from pathlib import Path
|
|
31
|
-
from typing import Any,
|
|
31
|
+
from typing import Any, Self, TypeVar
|
|
32
32
|
|
|
33
33
|
from mirakuru import TCPExecutor
|
|
34
34
|
from mirakuru.exceptions import ProcessFinishedWithError, TimeoutExpired
|
|
@@ -101,7 +101,7 @@ class PostgreSQLExecutor(TCPExecutor):
|
|
|
101
101
|
dbname: str,
|
|
102
102
|
*,
|
|
103
103
|
shell: bool = False,
|
|
104
|
-
timeout:
|
|
104
|
+
timeout: int | None = 60,
|
|
105
105
|
sleep: float = 0.1,
|
|
106
106
|
user: str = "postgres",
|
|
107
107
|
password: str | None = None,
|
|
@@ -189,7 +189,7 @@ class PostgreSQLExecutor(TCPExecutor):
|
|
|
189
189
|
"""
|
|
190
190
|
return "postgres"
|
|
191
191
|
|
|
192
|
-
def start(self
|
|
192
|
+
def start(self) -> Self:
|
|
193
193
|
"""Add check for postgresql version before starting process."""
|
|
194
194
|
if self.version < self.MIN_SUPPORTED_VERSION:
|
|
195
195
|
raise PostgreSQLUnsupported(
|
|
@@ -298,13 +298,13 @@ class PostgreSQLExecutor(TCPExecutor):
|
|
|
298
298
|
# remove old one if exists first.
|
|
299
299
|
self.clean_directory()
|
|
300
300
|
pgdata = str(Path(self.datadir).resolve())
|
|
301
|
-
options = ["--username
|
|
301
|
+
options = [f"--username={self.user}"]
|
|
302
302
|
|
|
303
303
|
if self.password:
|
|
304
304
|
password_file = tempfile.NamedTemporaryFile(delete=False)
|
|
305
305
|
password_path = password_file.name
|
|
306
306
|
try:
|
|
307
|
-
options += ["--auth=password", "--pwfile
|
|
307
|
+
options += ["--auth=password", f"--pwfile={password_path}"]
|
|
308
308
|
if hasattr(self.password, "encode"):
|
|
309
309
|
password = self.password.encode("utf-8")
|
|
310
310
|
else:
|
|
@@ -391,7 +391,7 @@ class PostgreSQLExecutor(TCPExecutor):
|
|
|
391
391
|
return self.running()
|
|
392
392
|
return super().check_subprocess()
|
|
393
393
|
|
|
394
|
-
def _windows_terminate_process(self, _sig:
|
|
394
|
+
def _windows_terminate_process(self, _sig: int | None = None) -> None:
|
|
395
395
|
"""Terminate process on Windows.
|
|
396
396
|
|
|
397
397
|
:param _sig: Signal parameter (unused on Windows but included for consistency)
|
|
@@ -423,7 +423,7 @@ class PostgreSQLExecutor(TCPExecutor):
|
|
|
423
423
|
e,
|
|
424
424
|
)
|
|
425
425
|
|
|
426
|
-
def stop(self
|
|
426
|
+
def stop(self, sig: int | None = None, exp_sig: int | None = None) -> Self:
|
|
427
427
|
"""Issue a stop request to executable."""
|
|
428
428
|
try:
|
|
429
429
|
subprocess.check_output(
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
# along with pytest-postgresql. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
"""Fixture factory for postgresql client."""
|
|
19
19
|
|
|
20
|
-
from
|
|
20
|
+
from collections.abc import AsyncIterator, Callable, Iterator
|
|
21
|
+
from typing import cast
|
|
21
22
|
|
|
22
23
|
import psycopg
|
|
23
24
|
import pytest
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import inspect
|
|
5
5
|
import warnings
|
|
6
|
+
from collections.abc import AsyncIterator, Callable, Iterator
|
|
6
7
|
from contextlib import asynccontextmanager, contextmanager
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
from types import TracebackType
|
|
9
|
-
from typing import
|
|
10
|
+
from typing import Self, TypeVar
|
|
10
11
|
|
|
11
12
|
import psycopg
|
|
12
13
|
import psycopg.sql as sql
|
|
@@ -204,14 +205,14 @@ class DatabaseJanitor(BaseDatabaseJanitor):
|
|
|
204
205
|
cur.close()
|
|
205
206
|
conn.close()
|
|
206
207
|
|
|
207
|
-
def __enter__(self
|
|
208
|
+
def __enter__(self) -> Self:
|
|
208
209
|
"""Initialize Database Janitor."""
|
|
209
210
|
self.init()
|
|
210
211
|
return self
|
|
211
212
|
|
|
212
213
|
def __exit__(
|
|
213
|
-
self
|
|
214
|
-
exc_type:
|
|
214
|
+
self,
|
|
215
|
+
exc_type: type[BaseException] | None,
|
|
215
216
|
exc_val: BaseException | None,
|
|
216
217
|
exc_tb: TracebackType | None,
|
|
217
218
|
) -> None:
|
|
@@ -322,14 +323,14 @@ class AsyncDatabaseJanitor(BaseDatabaseJanitor):
|
|
|
322
323
|
finally:
|
|
323
324
|
await conn.close()
|
|
324
325
|
|
|
325
|
-
async def __aenter__(self
|
|
326
|
+
async def __aenter__(self) -> Self:
|
|
326
327
|
"""Initialize Async Database Janitor."""
|
|
327
328
|
await self.init()
|
|
328
329
|
return self
|
|
329
330
|
|
|
330
331
|
async def __aexit__(
|
|
331
|
-
self
|
|
332
|
-
exc_type:
|
|
332
|
+
self,
|
|
333
|
+
exc_type: type[BaseException] | None,
|
|
333
334
|
exc_val: BaseException | None,
|
|
334
335
|
exc_tb: TracebackType | None,
|
|
335
336
|
) -> None:
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import importlib
|
|
4
4
|
import re
|
|
5
|
+
from collections.abc import Callable
|
|
5
6
|
from functools import partial
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from types import ModuleType
|
|
8
|
-
from typing import Any
|
|
9
|
+
from typing import Any
|
|
9
10
|
|
|
10
11
|
import psycopg
|
|
11
12
|
|
|
@@ -19,7 +20,7 @@ except ImportError:
|
|
|
19
20
|
def sql(sql_filename: Path, **kwargs: Any) -> None:
|
|
20
21
|
"""Database loader for sql files."""
|
|
21
22
|
with psycopg.connect(**kwargs) as db_connection:
|
|
22
|
-
with open(sql_filename
|
|
23
|
+
with open(sql_filename) as _fd:
|
|
23
24
|
with db_connection.cursor() as cur:
|
|
24
25
|
cur.execute(_fd.read())
|
|
25
26
|
db_connection.commit()
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import datetime
|
|
5
|
+
from collections.abc import Awaitable, Callable
|
|
5
6
|
from time import sleep
|
|
6
|
-
from typing import
|
|
7
|
+
from typing import TypeVar
|
|
7
8
|
|
|
8
9
|
T = TypeVar("T")
|
|
9
10
|
|
|
@@ -11,7 +12,7 @@ T = TypeVar("T")
|
|
|
11
12
|
def retry(
|
|
12
13
|
func: Callable[[], T],
|
|
13
14
|
timeout: int = 60,
|
|
14
|
-
possible_exception:
|
|
15
|
+
possible_exception: type[Exception] = Exception,
|
|
15
16
|
) -> T:
|
|
16
17
|
"""Attempt to retry the function for timeout time.
|
|
17
18
|
|
|
@@ -40,7 +41,7 @@ def retry(
|
|
|
40
41
|
async def retry_async(
|
|
41
42
|
func: Callable[[], Awaitable[T]],
|
|
42
43
|
timeout: int = 60,
|
|
43
|
-
possible_exception:
|
|
44
|
+
possible_exception: type[Exception] = Exception,
|
|
44
45
|
) -> T:
|
|
45
46
|
"""Attempt to retry the async function for timeout time.
|
|
46
47
|
|
|
@@ -68,4 +69,4 @@ async def retry_async(
|
|
|
68
69
|
|
|
69
70
|
def get_current_datetime() -> datetime.datetime:
|
|
70
71
|
"""Get the current timezone-aware UTC datetime."""
|
|
71
|
-
return datetime.datetime.now(datetime.
|
|
72
|
+
return datetime.datetime.now(datetime.UTC)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/executors/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytest_postgresql-9.1.1 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|