pytest-postgresql 9.1.0__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.
Files changed (23) hide show
  1. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/CHANGES.rst +34 -0
  2. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/PKG-INFO +5 -5
  3. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pyproject.toml +21 -18
  4. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pyproject.toml.orig +21 -18
  5. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/__init__.py +1 -2
  6. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/exceptions.py +1 -1
  7. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/executors/proc.py +7 -7
  8. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/client.py +2 -1
  9. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/noprocess.py +1 -1
  10. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/process.py +1 -1
  11. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/janitor.py +8 -7
  12. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/loader.py +3 -2
  13. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/retry.py +5 -4
  14. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/COPYING.lesser +0 -0
  15. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/README.rst +0 -0
  16. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/_asyncio_compat.py +0 -0
  17. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/config.py +0 -0
  18. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/executors/__init__.py +0 -0
  19. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/executors/noop.py +0 -0
  20. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/__init__.py +0 -0
  21. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/factories/_pg.py +0 -0
  22. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/plugin.py +0 -0
  23. {pytest_postgresql-9.1.0 → pytest_postgresql-10.0.0}/pytest_postgresql/py.typed +0 -0
@@ -3,6 +3,40 @@ 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
+
29
+ pytest-postgresql 9.1.1 (2026-10-04)
30
+ ====================================
31
+
32
+ Miscellaneous
33
+ -------------
34
+
35
+ - Update actions with zizmor 1.30.0 and migrate to maintained actionlint fork (`#1443 <https://github.com/dbfixtures/pytest-postgresql/issues/1443>`__)
36
+ - Adjust shared-automerge permissions (`#1457 <https://github.com/dbfixtures/pytest-postgresql/issues/1457>`__)
37
+ - Bump psycopg-binary alongside psycopg and group both packages in Dependabot updates (`#1460 <https://github.com/dbfixtures/pytest-postgresql/issues/1460>`__)
38
+
39
+
6
40
  pytest-postgresql 9.1.0 (2026-09-04)
7
41
  ====================================
8
42
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-postgresql
3
- Version: 9.1.0
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.2
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.10
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/v9.1.0/CHANGES.rst
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.13"]
3
+ requires = ["uv-build>=0.11,<0.14"]
4
4
 
5
5
  [project]
6
6
  name = "pytest-postgresql"
7
- version = "9.1.0"
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.10"
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.2",
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/v9.1.0/CHANGES.rst"
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,18 +63,18 @@ pytest_postgresql = "pytest_postgresql.plugin"
63
63
  [dependency-groups]
64
64
  dev = [
65
65
  "aiofiles==25.1.0",
66
- "coverage==7.15.4",
67
- "mirakuru==3.0.2",
66
+ "coverage==7.17.0",
67
+ "mirakuru==3.0.4",
68
68
  "mock==5.2.0",
69
- "mypy==2.3.1; implementation_name=='cpython'",
69
+ "mypy==2.4.0; implementation_name=='cpython'",
70
70
  "packaging==26.3",
71
- "port-for==1.0.0",
72
- "psycopg==3.3.4",
73
- "psycopg-binary==3.3.4; implementation_name=='cpython' and python_version<'3.15'",
71
+ "port-for==1.1.1",
72
+ "psycopg==3.3.6",
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.0",
75
+ "pytest-asyncio==1.4.1",
76
76
  "pytest-xdist==3.8.0",
77
- "towncrier==25.8.0",
77
+ "towncrier==26.9.0",
78
78
  "types-aiofiles==25.1.0.20260518",
79
79
  ]
80
80
  release = ["tbump==6.11.0"]
@@ -85,17 +85,19 @@ module-root = ""
85
85
  source-include = ["CHANGES.rst"]
86
86
 
87
87
  [tool.ruff]
88
- target-version = "py310"
88
+ target-version = "py311"
89
89
  line-length = 120
90
90
 
91
91
  [tool.ruff.lint]
92
92
  select = [
93
+ "D",
93
94
  "E",
94
95
  "F",
95
- "I",
96
- "D",
97
96
  "FBT",
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 = "9.1.0"
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.13" ]
3
+ requires = [ "uv-build>=0.11,<0.14" ]
4
4
 
5
5
  [project]
6
6
  name = "pytest-postgresql"
7
- version = "9.1.0"
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.10"
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.2" ]
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/v9.1.0/CHANGES.rst"
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,18 +49,18 @@ pytest_postgresql = "pytest_postgresql.plugin"
49
49
  [dependency-groups]
50
50
  dev = [
51
51
  "aiofiles==25.1.0",
52
- "coverage==7.15.4",
53
- "mirakuru==3.0.2",
52
+ "coverage==7.17.0",
53
+ "mirakuru==3.0.4",
54
54
  "mock==5.2.0",
55
- "mypy==2.3.1; implementation_name=='cpython'",
55
+ "mypy==2.4.0; implementation_name=='cpython'",
56
56
  "packaging==26.3",
57
- "port-for==1.0.0",
58
- "psycopg==3.3.4",
59
- "psycopg-binary==3.3.4; implementation_name=='cpython' and python_version<'3.15'",
57
+ "port-for==1.1.1",
58
+ "psycopg==3.3.6",
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.0",
61
+ "pytest-asyncio==1.4.1",
62
62
  "pytest-xdist==3.8.0",
63
- "towncrier==25.8.0",
63
+ "towncrier==26.9.0",
64
64
  "types-aiofiles==25.1.0.20260518",
65
65
  ]
66
66
  release = [
@@ -73,17 +73,19 @@ module-root = ""
73
73
  source-include = [ "CHANGES.rst" ]
74
74
 
75
75
  [tool.ruff]
76
- target-version = "py310"
76
+ target-version = "py311"
77
77
  line-length = 120
78
78
 
79
79
  [tool.ruff.lint]
80
80
  select = [
81
+ "D", # pydocstyle
81
82
  "E", # pycodestyle
82
83
  "F", # pyflakes
83
- "I", # isort
84
- "D", # pydocstyle
85
84
  "FBT", # flake8-boolean-trap
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 = "9.1.0"
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__ = "9.1.0"
20
+ __version__ = "10.0.0"
@@ -1,6 +1,6 @@
1
1
  """pytest-postgresql's exceptions."""
2
2
 
3
- from typing import Iterable
3
+ from collections.abc import Iterable
4
4
 
5
5
 
6
6
  class ExecutableMissingException(FileNotFoundError):
@@ -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, Optional, TypeVar
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: Optional[int] = 60,
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: T) -> T:
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=%s" % self.user]
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=%s" % password_path]
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: Optional[int] = None) -> None:
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: T, sig: Optional[int] = None, exp_sig: Optional[int] = None) -> T:
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 typing import AsyncIterator, Callable, Iterator, cast
20
+ from collections.abc import AsyncIterator, Callable, Iterator
21
+ from typing import cast
21
22
 
22
23
  import psycopg
23
24
  import pytest
@@ -18,8 +18,8 @@
18
18
  """Fixture factory for existing postgresql server."""
19
19
 
20
20
  import os
21
+ from collections.abc import Callable, Iterator
21
22
  from pathlib import Path
22
- from typing import Callable, Iterator
23
23
 
24
24
  import pytest
25
25
 
@@ -22,8 +22,8 @@ import os
22
22
  import os.path
23
23
  import platform
24
24
  import tempfile
25
+ from collections.abc import Callable, Iterable, Iterator
25
26
  from pathlib import Path
26
- from typing import Callable, Iterable, Iterator
27
27
 
28
28
  import port_for
29
29
  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 AsyncIterator, Callable, Iterator, Type, TypeVar
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: DatabaseJanitorType) -> DatabaseJanitorType:
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: DatabaseJanitorType,
214
- exc_type: Type[BaseException] | None,
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: AsyncDatabaseJanitorType) -> AsyncDatabaseJanitorType:
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: AsyncDatabaseJanitorType,
332
- exc_type: Type[BaseException] | None,
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, Callable
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, "r") as _fd:
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 Awaitable, Callable, Type, TypeVar
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: Type[Exception] = 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: Type[Exception] = 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.timezone.utc)
72
+ return datetime.datetime.now(datetime.UTC)