pytest-databases 0.7.2__tar.gz → 0.9.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 (72) hide show
  1. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/PKG-INFO +7 -9
  2. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/pyproject.toml +14 -23
  3. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/__init__.py +12 -12
  4. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/alloydb_omni.py +13 -16
  5. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/azure_blob.py +3 -3
  6. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/bigquery.py +7 -7
  7. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/cockroachdb.py +13 -16
  8. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.oracle.yml +2 -2
  9. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/dragonfly.py +6 -17
  10. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/elastic_search.py +18 -18
  11. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/keydb.py +6 -17
  12. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/mariadb.py +21 -43
  13. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/mssql.py +52 -29
  14. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/mysql.py +41 -41
  15. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/oracle.py +38 -38
  16. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/postgres.py +101 -111
  17. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/redis.py +9 -9
  18. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/spanner.py +6 -6
  19. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/valkey.py +6 -17
  20. pytest_databases-0.9.0/src/pytest_databases/helpers.py +21 -0
  21. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/conftest.py +0 -5
  22. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_alloydb_omni.py +11 -9
  23. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_azure_blob.py +1 -5
  24. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_bigquery.py +3 -5
  25. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_cockroachdb.py +7 -10
  26. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_dragonfly.py +3 -6
  27. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_elasticsearch.py +17 -18
  28. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_keydb.py +3 -6
  29. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_mariadb.py +18 -20
  30. pytest_databases-0.9.0/tests/docker/test_mssql.py +98 -0
  31. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_mysql.py +30 -51
  32. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_oracle.py +31 -33
  33. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_postgres.py +39 -50
  34. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_redis.py +2 -5
  35. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_spanner.py +3 -5
  36. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/test_valkey.py +4 -6
  37. pytest_databases-0.7.2/src/pytest_databases/helpers.py +0 -79
  38. pytest_databases-0.7.2/tests/docker/test_mssql.py +0 -93
  39. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/.gitignore +0 -0
  40. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/.pre-commit-config.yaml +0 -0
  41. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/.sourcery.yaml +0 -0
  42. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/.vscode/launch.json +0 -0
  43. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/.vscode/settings.json +0 -0
  44. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/CODEOWNERS +0 -0
  45. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/CONTRIBUTING.rst +0 -0
  46. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/LICENSE +0 -0
  47. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/Makefile +0 -0
  48. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/README.md +0 -0
  49. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/scripts/__init__.py +0 -0
  50. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/scripts/build_docs.py +0 -0
  51. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/scripts/convert_docs.sh +0 -0
  52. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/scripts/install-hatch.sh +0 -0
  53. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/sonar-project.properties +0 -0
  54. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/__init__.py +0 -0
  55. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/__metadata__.py +0 -0
  56. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.alloydb-omni.yml +0 -0
  57. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.azurite.yml +0 -0
  58. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.bigquery.yml +0 -0
  59. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.cockroachdb.yml +0 -0
  60. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.dragonfly.yml +0 -0
  61. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.elasticsearch.yml +0 -0
  62. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.keydb.yml +0 -0
  63. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.mariadb.yml +0 -0
  64. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.mssql.yml +0 -0
  65. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.mysql.yml +0 -0
  66. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.postgres.yml +0 -0
  67. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.redis.yml +0 -0
  68. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.spanner.yml +0 -0
  69. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/docker/docker-compose.valkey.yml +0 -0
  70. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/src/pytest_databases/py.typed +0 -0
  71. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/__init__.py +0 -0
  72. {pytest_databases-0.7.2 → pytest_databases-0.9.0}/tests/docker/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-databases
3
- Version: 0.7.2
3
+ Version: 0.9.0
4
4
  Summary: Reusable database fixtures for any and all databases.
5
5
  Project-URL: Documentation, https://github.com/litestar-org/pytest-databases#readme
6
6
  Project-URL: Issues, https://github.com/litestar-org/pytest-databases/issues
@@ -8,7 +8,7 @@ Project-URL: Source, https://github.com/litestar-org/pytest-databases
8
8
  Author-email: Cody Fincher <cody.fincher@gmail.com>
9
9
  License-Expression: MIT
10
10
  License-File: LICENSE
11
- Keywords: alloydb,alloydbomni,bigquery,cockroachdb,database,duckdb,elasticsearch,migration,mssql,mysql,oracle,postgres,redis,spanner
11
+ Keywords: alloydb,alloydbomni,azure,bigquery,cockroachdb,database,duckdb,elasticsearch,migration,mssql,mysql,oracle,postgres,redis,spanner
12
12
  Classifier: Development Status :: 4 - Beta
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3.8
@@ -29,25 +29,23 @@ Requires-Dist: psycopg; extra == 'cockroachdb'
29
29
  Provides-Extra: dragonfly
30
30
  Requires-Dist: redis; extra == 'dragonfly'
31
31
  Provides-Extra: elasticsearch7
32
- Requires-Dist: elasticsearch7[async]; extra == 'elasticsearch7'
32
+ Requires-Dist: elasticsearch7; extra == 'elasticsearch7'
33
33
  Provides-Extra: elasticsearch8
34
- Requires-Dist: elasticsearch8[async]; extra == 'elasticsearch8'
34
+ Requires-Dist: elasticsearch8; extra == 'elasticsearch8'
35
35
  Provides-Extra: keydb
36
36
  Requires-Dist: redis; extra == 'keydb'
37
37
  Provides-Extra: mssql
38
- Requires-Dist: aioodbc; extra == 'mssql'
38
+ Requires-Dist: pymssql; extra == 'mssql'
39
39
  Provides-Extra: mysql
40
- Requires-Dist: asyncmy>=0.2.9; extra == 'mysql'
40
+ Requires-Dist: pymysql; extra == 'mysql'
41
41
  Provides-Extra: oracle
42
42
  Requires-Dist: oracledb; extra == 'oracle'
43
43
  Provides-Extra: postgres
44
- Requires-Dist: asyncpg>=0.29.0; extra == 'postgres'
44
+ Requires-Dist: psycopg>=3; extra == 'postgres'
45
45
  Provides-Extra: redis
46
46
  Requires-Dist: redis; extra == 'redis'
47
47
  Provides-Extra: spanner
48
48
  Requires-Dist: google-cloud-spanner; extra == 'spanner'
49
- Provides-Extra: sqlite
50
- Requires-Dist: aiosqlite; extra == 'sqlite'
51
49
  Description-Content-Type: text/markdown
52
50
 
53
51
  # Pytest Databases
@@ -12,7 +12,7 @@ license = "MIT"
12
12
  name = "pytest-databases"
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.8"
15
- version = "0.7.2"
15
+ version = "0.9.0"
16
16
  #
17
17
  authors = [{ name = "Cody Fincher", email = "cody.fincher@gmail.com" }]
18
18
  keywords = [
@@ -30,6 +30,7 @@ keywords = [
30
30
  "cockroachdb",
31
31
  "redis",
32
32
  "elasticsearch",
33
+ "azure",
33
34
  ]
34
35
  # options under https://pypi.org/classifiers/
35
36
  classifiers = [
@@ -56,16 +57,15 @@ azure-storage = ["azure-storage-blob"]
56
57
  bigquery = ["google-cloud-bigquery"]
57
58
  cockroachdb = ["psycopg"]
58
59
  dragonfly = ["redis"]
59
- elasticsearch7 = ["elasticsearch7[async]"]
60
- elasticsearch8 = ["elasticsearch8[async]"]
60
+ elasticsearch7 = ["elasticsearch7"]
61
+ elasticsearch8 = ["elasticsearch8"]
61
62
  keydb = ["redis"]
62
- mssql = ["aioodbc"]
63
- mysql = ["asyncmy>=0.2.9"]
63
+ mssql = ["pymssql"]
64
+ mysql = ["pymysql"]
64
65
  oracle = ["oracledb"]
65
- postgres = ["asyncpg>=0.29.0"]
66
+ postgres = ["psycopg>=3"]
66
67
  redis = ["redis"]
67
68
  spanner = ["google-cloud-spanner"]
68
- sqlite = ["aiosqlite"]
69
69
 
70
70
 
71
71
  ######################
@@ -86,14 +86,12 @@ allow-direct-references = true
86
86
  [tool.hatch.envs.default]
87
87
  extra-dependencies = [
88
88
  # tests
89
- "anyio",
90
89
  "coverage[toml]>=6.2",
91
90
  "coverage[toml]>=6.2",
92
91
  "pytest",
93
92
  "pytest-cov",
94
93
  "pytest-mock",
95
94
  "pytest-vcr",
96
- "pytest-sugar",
97
95
  "pytest-click",
98
96
  "pytest-xdist",
99
97
  # lint
@@ -105,9 +103,9 @@ extra-dependencies = [
105
103
  "types-six",
106
104
  "types-decorator",
107
105
  "types-pyyaml",
108
- "asyncpg-stubs",
109
106
  "types-docutils",
110
107
  "types-redis",
108
+ "types-pymysql",
111
109
  # docs
112
110
  "sphinx>=7.1.2",
113
111
  "sphinx-autobuild>=2021.3.14",
@@ -127,14 +125,12 @@ python = "3.12"
127
125
  [tool.hatch.envs.test]
128
126
  extra-dependencies = [
129
127
  # tests
130
- "anyio",
131
128
  "coverage[toml]>=6.2",
132
129
  "coverage[toml]>=6.2",
133
130
  "pytest",
134
131
  "pytest-cov",
135
132
  "pytest-mock",
136
133
  "pytest-vcr",
137
- "pytest-sugar",
138
134
  "pytest-click",
139
135
  "pytest-xdist",
140
136
  # lint
@@ -146,9 +142,9 @@ extra-dependencies = [
146
142
  "types-six",
147
143
  "types-decorator",
148
144
  "types-pyyaml",
149
- "asyncpg-stubs",
150
145
  "types-docutils",
151
146
  "types-redis",
147
+ "types-pymysql",
152
148
  # docs
153
149
  "sphinx>=7.1.2",
154
150
  "sphinx-autobuild>=2021.3.14",
@@ -196,14 +192,12 @@ no-cov = "cov --no-cov"
196
192
  [tool.hatch.envs.docs]
197
193
  extra-dependencies = [
198
194
  # tests
199
- "anyio",
200
195
  "coverage[toml]>=6.2",
201
196
  "coverage[toml]>=6.2",
202
197
  "pytest",
203
198
  "pytest-cov",
204
199
  "pytest-mock",
205
200
  "pytest-vcr",
206
- "pytest-sugar",
207
201
  "pytest-click",
208
202
  "pytest-xdist",
209
203
  # lint
@@ -215,9 +209,9 @@ extra-dependencies = [
215
209
  "types-six",
216
210
  "types-decorator",
217
211
  "types-pyyaml",
218
- "asyncpg-stubs",
219
212
  "types-docutils",
220
213
  "types-redis",
214
+ "types-pymysql",
221
215
  # docs
222
216
  "sphinx>=7.1.2",
223
217
  "sphinx-autobuild>=2021.3.14",
@@ -241,6 +235,7 @@ features = [
241
235
  "elasticsearch7",
242
236
  "elasticsearch8",
243
237
  "bigquery",
238
+ "azure-storage",
244
239
  ]
245
240
  python = "3.11"
246
241
  template = "default"
@@ -261,14 +256,12 @@ build-check = ["build", "validate"]
261
256
  [tool.hatch.envs.local]
262
257
  extra-dependencies = [
263
258
  # tests
264
- "anyio",
265
259
  "coverage[toml]>=6.2",
266
260
  "coverage[toml]>=6.2",
267
261
  "pytest",
268
262
  "pytest-cov",
269
263
  "pytest-mock",
270
264
  "pytest-vcr",
271
- "pytest-sugar",
272
265
  "pytest-click",
273
266
  "pytest-xdist",
274
267
  # lint
@@ -280,9 +273,9 @@ extra-dependencies = [
280
273
  "types-six",
281
274
  "types-decorator",
282
275
  "types-pyyaml",
283
- "asyncpg-stubs",
284
276
  "types-docutils",
285
277
  "types-redis",
278
+ "types-pymysql",
286
279
  # docs
287
280
  "sphinx>=7.1.2",
288
281
  "sphinx-autobuild>=2021.3.14",
@@ -305,6 +298,7 @@ features = [
305
298
  "elasticsearch7",
306
299
  "elasticsearch8",
307
300
  "bigquery",
301
+ "azure-storage",
308
302
  ]
309
303
  path = ".venv/"
310
304
  python = "3.11"
@@ -316,14 +310,12 @@ type = "virtual"
316
310
  [tool.hatch.envs.lint]
317
311
  extra-dependencies = [
318
312
  # tests
319
- "anyio",
320
313
  "coverage[toml]>=6.2",
321
314
  "coverage[toml]>=6.2",
322
315
  "pytest",
323
316
  "pytest-cov",
324
317
  "pytest-mock",
325
318
  "pytest-vcr",
326
- "pytest-sugar",
327
319
  "pytest-click",
328
320
  "pytest-xdist",
329
321
  # lint
@@ -335,9 +327,9 @@ extra-dependencies = [
335
327
  "types-six",
336
328
  "types-decorator",
337
329
  "types-pyyaml",
338
- "asyncpg-stubs",
339
330
  "types-docutils",
340
331
  "types-redis",
332
+ "types-pymysql",
341
333
  # docs
342
334
  "sphinx>=7.1.2",
343
335
  "sphinx-autobuild>=2021.3.14",
@@ -480,7 +472,6 @@ module = ["docutils.nodes.*"]
480
472
  [[tool.mypy.overrides]]
481
473
  ignore_missing_imports = true
482
474
  module = [
483
- "asyncmy",
484
475
  "pyodbc",
485
476
  "google.auth.*",
486
477
  "google.cloud.*",
@@ -1,13 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
- import asyncio
4
3
  import os
5
4
  import re
6
5
  import subprocess # noqa: S404
6
+ import time
7
7
  import timeit
8
8
  from typing import TYPE_CHECKING, Any, Callable, Iterable
9
9
 
10
- from pytest_databases.helpers import simple_string_hash, wrap_sync
10
+ from pytest_databases.helpers import simple_string_hash
11
11
 
12
12
  if TYPE_CHECKING:
13
13
  from collections.abc import Awaitable, Generator
@@ -16,9 +16,9 @@ if TYPE_CHECKING:
16
16
  TRUE_VALUES = {"True", "true", "1", "yes", "Y", "T"}
17
17
 
18
18
 
19
- async def wait_until_responsive(
20
- check: Callable[..., Awaitable],
21
- timeout: float, # noqa: ASYNC109
19
+ def wait_until_responsive(
20
+ check: Callable[..., bool],
21
+ timeout: float,
22
22
  pause: float,
23
23
  **kwargs: Any,
24
24
  ) -> None:
@@ -33,9 +33,9 @@ async def wait_until_responsive(
33
33
  ref = timeit.default_timer()
34
34
  now = ref
35
35
  while (now - ref) < timeout: # sourcery skip
36
- if await check(**kwargs):
36
+ if check(**kwargs):
37
37
  return
38
- await asyncio.sleep(pause)
38
+ time.sleep(pause)
39
39
  now = timeit.default_timer()
40
40
 
41
41
  msg = "Timeout reached while waiting on service!"
@@ -81,13 +81,13 @@ class DockerServiceRegistry:
81
81
  command = [*self._base_command, *self._compose_files, *args]
82
82
  subprocess.run(command, check=True, capture_output=True)
83
83
 
84
- async def start(
84
+ def start(
85
85
  self,
86
86
  name: str,
87
87
  docker_compose_files: list[Path],
88
88
  *,
89
- check: Callable[..., Any],
90
- timeout: float = 30, # noqa: ASYNC109
89
+ check: Callable[..., bool],
90
+ timeout: float = 30,
91
91
  pause: float = 0.1,
92
92
  **kwargs: Any,
93
93
  ) -> None:
@@ -101,8 +101,8 @@ class DockerServiceRegistry:
101
101
  self.run_command("up", "--force-recreate", "-d", name)
102
102
  self._running_services.add(name)
103
103
 
104
- await wait_until_responsive(
105
- check=wrap_sync(check),
104
+ wait_until_responsive(
105
+ check=check,
106
106
  timeout=timeout,
107
107
  pause=pause,
108
108
  host=self.docker_ip,
@@ -3,9 +3,9 @@ from __future__ import annotations
3
3
  import os
4
4
  import sys
5
5
  from pathlib import Path
6
- from typing import TYPE_CHECKING, AsyncGenerator
6
+ from typing import TYPE_CHECKING
7
7
 
8
- import asyncpg
8
+ import psycopg
9
9
  import pytest
10
10
 
11
11
  from pytest_databases.docker import DockerServiceRegistry
@@ -18,9 +18,9 @@ if TYPE_CHECKING:
18
18
  COMPOSE_PROJECT_NAME: str = f"pytest-databases-alloydb-{simple_string_hash(__file__)}"
19
19
 
20
20
 
21
- async def alloydb_omni_responsive(host: str, port: int, user: str, password: str, database: str) -> bool:
21
+ def alloydb_omni_responsive(host: str, port: int, user: str, password: str, database: str) -> bool:
22
22
  try:
23
- conn = await asyncpg.connect(
23
+ conn = psycopg.connect(
24
24
  host=host,
25
25
  port=port,
26
26
  user=user,
@@ -31,10 +31,10 @@ async def alloydb_omni_responsive(host: str, port: int, user: str, password: str
31
31
  return False
32
32
 
33
33
  try:
34
- db_open = await conn.fetchrow("SELECT 1")
34
+ db_open = conn.fetchrow("SELECT 1")
35
35
  return bool(db_open is not None and db_open[0] == 1)
36
36
  finally:
37
- await conn.close()
37
+ conn.close()
38
38
 
39
39
 
40
40
  @pytest.fixture(scope="session")
@@ -93,7 +93,7 @@ def alloydb_docker_ip(alloydb_docker_services: DockerServiceRegistry) -> str:
93
93
 
94
94
  # alias to the latest
95
95
  @pytest.fixture(autouse=False, scope="session")
96
- async def alloydb_omni_service(
96
+ def alloydb_omni_service(
97
97
  alloydb_docker_services: DockerServiceRegistry,
98
98
  default_alloydb_omni_service_name: str,
99
99
  alloydb_docker_compose_files: list[Path],
@@ -101,12 +101,12 @@ async def alloydb_omni_service(
101
101
  postgres_database: str,
102
102
  postgres_user: str,
103
103
  postgres_password: str,
104
- ) -> AsyncGenerator[None, None]:
104
+ ) -> Generator[None, None, None]:
105
105
  os.environ["POSTGRES_PASSWORD"] = postgres_password
106
106
  os.environ["POSTGRES_USER"] = postgres_user
107
107
  os.environ["POSTGRES_DATABASE"] = postgres_database
108
108
  os.environ[f"{default_alloydb_omni_service_name.upper()}_PORT"] = str(alloydb_omni_port)
109
- await alloydb_docker_services.start(
109
+ alloydb_docker_services.start(
110
110
  name=default_alloydb_omni_service_name,
111
111
  docker_compose_files=alloydb_docker_compose_files,
112
112
  timeout=45,
@@ -121,22 +121,19 @@ async def alloydb_omni_service(
121
121
 
122
122
 
123
123
  @pytest.fixture(autouse=False, scope="session")
124
- async def alloydb_omni_startup_connection(
124
+ def alloydb_omni_startup_connection(
125
125
  alloydb_omni_service: DockerServiceRegistry,
126
126
  alloydb_docker_ip: str,
127
127
  alloydb_omni_port: int,
128
128
  postgres_database: str,
129
129
  postgres_user: str,
130
130
  postgres_password: str,
131
- ) -> AsyncGenerator[asyncpg.Connection[asyncpg.Record], None]:
132
- conn = await asyncpg.connect(
131
+ ) -> Generator[psycopg.Connection, None, None]:
132
+ with psycopg.connect(
133
133
  host=alloydb_docker_ip,
134
134
  port=alloydb_omni_port,
135
135
  user=postgres_user,
136
136
  database=postgres_database,
137
137
  password=postgres_password,
138
- )
139
- try:
138
+ ) as conn:
140
139
  yield conn
141
- finally:
142
- await conn.close()
@@ -140,14 +140,14 @@ async def azure_blob_async_container_client(
140
140
 
141
141
 
142
142
  @pytest.fixture(autouse=False, scope="session")
143
- async def azure_blob_service(
143
+ def azure_blob_service(
144
144
  azure_blob_docker_services: DockerServiceRegistry,
145
145
  default_azure_blob_redis_service_name: str,
146
146
  azure_blob_docker_compose_files: list[Path],
147
147
  azure_blob_connection_string: str,
148
148
  azure_blob_port: int,
149
149
  azure_blob_default_container_name: str,
150
- ) -> AsyncGenerator[None, None]:
150
+ ) -> Generator[None, None, None]:
151
151
  os.environ["AZURE_BLOB_PORT"] = str(azure_blob_port)
152
152
 
153
153
  def azurite_responsive(host: str, port: int) -> bool:
@@ -157,7 +157,7 @@ async def azure_blob_service(
157
157
  logs = _get_container_logs(str(azure_blob_docker_compose_files[0].absolute()))
158
158
  return "Azurite Blob service successfully listens on" in logs
159
159
 
160
- await azure_blob_docker_services.start(
160
+ azure_blob_docker_services.start(
161
161
  name=default_azure_blob_redis_service_name,
162
162
  docker_compose_files=azure_blob_docker_compose_files,
163
163
  check=azurite_responsive,
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import os
4
4
  import sys
5
5
  from pathlib import Path
6
- from typing import TYPE_CHECKING, AsyncGenerator
6
+ from typing import TYPE_CHECKING
7
7
 
8
8
  import pytest
9
9
  from google.api_core.client_options import ClientOptions
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
20
20
  COMPOSE_PROJECT_NAME: str = f"pytest-databases-bigquery-{simple_string_hash(__file__)}"
21
21
 
22
22
 
23
- async def bigquery_responsive(
23
+ def bigquery_responsive(
24
24
  host: str,
25
25
  bigquery_endpoint: str,
26
26
  bigquery_dataset: str,
@@ -111,7 +111,7 @@ def bigquery_endpoint(bigquery_docker_ip: str, bigquery_port: int) -> str:
111
111
 
112
112
 
113
113
  @pytest.fixture(autouse=False, scope="session")
114
- async def bigquery_service(
114
+ def bigquery_service(
115
115
  bigquery_docker_services: DockerServiceRegistry,
116
116
  default_bigquery_service_name: str,
117
117
  bigquery_docker_compose_files: list[Path],
@@ -122,13 +122,13 @@ async def bigquery_service(
122
122
  bigquery_project: str,
123
123
  bigquery_credentials: Credentials,
124
124
  bigquery_client_options: ClientOptions,
125
- ) -> AsyncGenerator[None, None]:
125
+ ) -> Generator[None, None, None]:
126
126
  os.environ["BIGQUERY_ENDPOINT"] = bigquery_endpoint
127
127
  os.environ["BIGQUERY_DATASET"] = bigquery_dataset
128
128
  os.environ["BIGQUERY_PORT"] = str(bigquery_port)
129
129
  os.environ["BIGQUERY_GRPC_PORT"] = str(bigquery_grpc_port)
130
130
  os.environ["GOOGLE_CLOUD_PROJECT"] = bigquery_project
131
- await bigquery_docker_services.start(
131
+ bigquery_docker_services.start(
132
132
  name=default_bigquery_service_name,
133
133
  docker_compose_files=bigquery_docker_compose_files,
134
134
  timeout=60,
@@ -143,12 +143,12 @@ async def bigquery_service(
143
143
 
144
144
 
145
145
  @pytest.fixture(autouse=False, scope="session")
146
- async def bigquery_startup_connection(
146
+ def bigquery_startup_connection(
147
147
  bigquery_service: DockerServiceRegistry,
148
148
  bigquery_project: str,
149
149
  bigquery_credentials: Credentials,
150
150
  bigquery_client_options: ClientOptions,
151
- ) -> AsyncGenerator[bigquery.Client, None]:
151
+ ) -> Generator[bigquery.Client, None, None]:
152
152
  yield bigquery.Client(
153
153
  project=bigquery_project, client_options=bigquery_client_options, credentials=bigquery_credentials
154
154
  )
@@ -3,9 +3,9 @@ from __future__ import annotations
3
3
  import os
4
4
  import sys
5
5
  from pathlib import Path
6
- from typing import TYPE_CHECKING, AsyncGenerator
6
+ from typing import TYPE_CHECKING
7
7
 
8
- import asyncpg
8
+ import psycopg
9
9
  import pytest
10
10
 
11
11
  from pytest_databases.docker import DockerServiceRegistry
@@ -18,18 +18,18 @@ if TYPE_CHECKING:
18
18
  COMPOSE_PROJECT_NAME: str = f"pytest-databases-cockroachdb-{simple_string_hash(__file__)}"
19
19
 
20
20
 
21
- async def cockroachdb_responsive(host: str, port: int, database: str, driver_opts: dict[str, str]) -> bool:
21
+ def cockroachdb_responsive(host: str, port: int, database: str, driver_opts: dict[str, str]) -> bool:
22
22
  opts = "&".join(f"{k}={v}" for k, v in driver_opts.items()) if driver_opts else ""
23
23
  try:
24
- conn = await asyncpg.connect(f"postgresql://root@{host}:{port}/{database}?{opts}")
24
+ conn = psycopg.connect(f"postgresql://root@{host}:{port}/{database}?{opts}")
25
25
  except Exception: # noqa: BLE001
26
26
  return False
27
27
 
28
28
  try:
29
- db_open = await conn.fetchrow("SELECT 1")
29
+ db_open = conn.execute("SELECT 1").fetchone()
30
30
  return bool(db_open is not None and db_open[0] == 1)
31
31
  finally:
32
- await conn.close()
32
+ conn.close()
33
33
 
34
34
 
35
35
  @pytest.fixture(scope="session")
@@ -82,17 +82,17 @@ def cockroachdb_docker_ip(cockroachdb_docker_services: DockerServiceRegistry) ->
82
82
 
83
83
 
84
84
  @pytest.fixture(autouse=False, scope="session")
85
- async def cockroachdb_service(
85
+ def cockroachdb_service(
86
86
  cockroachdb_docker_services: DockerServiceRegistry,
87
87
  default_cockroachdb_service_name: str,
88
88
  cockroachdb_docker_compose_files: list[Path],
89
89
  cockroachdb_port: int,
90
90
  cockroachdb_database: str,
91
91
  cockroachdb_driver_opts: dict[str, str],
92
- ) -> AsyncGenerator[None, None]:
92
+ ) -> Generator[None, None, None]:
93
93
  os.environ["COCKROACHDB_DATABASE"] = cockroachdb_database
94
94
  os.environ["COCKROACHDB_PORT"] = str(cockroachdb_port)
95
- await cockroachdb_docker_services.start(
95
+ cockroachdb_docker_services.start(
96
96
  name=default_cockroachdb_service_name,
97
97
  docker_compose_files=cockroachdb_docker_compose_files,
98
98
  timeout=60,
@@ -106,18 +106,15 @@ async def cockroachdb_service(
106
106
 
107
107
 
108
108
  @pytest.fixture(autouse=False, scope="session")
109
- async def cockroachdb_startup_connection(
109
+ def cockroachdb_startup_connection(
110
110
  cockroachdb_service: DockerServiceRegistry,
111
111
  cockroachdb_docker_ip: str,
112
112
  cockroachdb_port: int,
113
113
  cockroachdb_database: str,
114
114
  cockroachdb_driver_opts: dict[str, str],
115
- ) -> AsyncGenerator[asyncpg.Connection[asyncpg.Record], None]:
115
+ ) -> Generator[psycopg.Connection, None, None]:
116
116
  opts = "&".join(f"{k}={v}" for k, v in cockroachdb_driver_opts.items()) if cockroachdb_driver_opts else ""
117
- conn = await asyncpg.connect(
117
+ with psycopg.connect(
118
118
  f"postgresql://root@{cockroachdb_docker_ip}:{cockroachdb_port}/{cockroachdb_database}?{opts}"
119
- )
120
- try:
119
+ ) as conn:
121
120
  yield conn
122
- finally:
123
- await conn.close()
@@ -9,12 +9,12 @@ services:
9
9
  ORACLE_PASSWORD: ${ORACLE_SYSTEM_PASSWORD:-super-secret}
10
10
  APP_USER_PASSWORD: ${ORACLE_PASSWORD:-super-secret}
11
11
  APP_USER: ${ORACLE_USER:-app}
12
- oracle23c:
12
+ oracle23ai:
13
13
  networks:
14
14
  - default
15
15
  image: gvenzl/oracle-free:23-slim-faststart
16
16
  ports:
17
- - "${ORACLE23C_PORT:-1513}:1521" # use a non-standard port here
17
+ - "${ORACLE23AI_PORT:-1513}:1521" # use a non-standard port here
18
18
  environment:
19
19
  ORACLE_PASSWORD: ${ORACLE_SYSTEM_PASSWORD:-super-secret}
20
20
  APP_USER_PASSWORD: ${ORACLE_PASSWORD:-super-secret}
@@ -3,13 +3,12 @@ from __future__ import annotations
3
3
  import os
4
4
  import sys
5
5
  from pathlib import Path
6
- from typing import TYPE_CHECKING, AsyncGenerator
6
+ from typing import TYPE_CHECKING
7
7
 
8
8
  import pytest
9
- from redis.asyncio import Redis as AsyncRedis
10
- from redis.exceptions import ConnectionError as RedisConnectionError
11
9
 
12
10
  from pytest_databases.docker import DockerServiceRegistry
11
+ from pytest_databases.docker.redis import redis_responsive
13
12
  from pytest_databases.helpers import simple_string_hash
14
13
 
15
14
  if TYPE_CHECKING:
@@ -18,16 +17,6 @@ if TYPE_CHECKING:
18
17
  COMPOSE_PROJECT_NAME: str = f"pytest-databases-dragonfly-{simple_string_hash(__file__)}"
19
18
 
20
19
 
21
- async def dragonfly_responsive(host: str, port: int) -> bool:
22
- client: AsyncRedis = AsyncRedis(host=host, port=port)
23
- try:
24
- return await client.ping()
25
- except (ConnectionError, RedisConnectionError):
26
- return False
27
- finally:
28
- await client.aclose() # type: ignore[attr-defined]
29
-
30
-
31
20
  @pytest.fixture(scope="session")
32
21
  def dragonfly_compose_project_name() -> str:
33
22
  return os.environ.get("COMPOSE_PROJECT_NAME", COMPOSE_PROJECT_NAME)
@@ -68,17 +57,17 @@ def dragonfly_docker_ip(dragonfly_docker_services: DockerServiceRegistry) -> str
68
57
 
69
58
 
70
59
  @pytest.fixture(autouse=False, scope="session")
71
- async def dragonfly_service(
60
+ def dragonfly_service(
72
61
  dragonfly_docker_services: DockerServiceRegistry,
73
62
  default_dragonfly_service_name: str,
74
63
  dragonfly_docker_compose_files: list[Path],
75
64
  dragonfly_port: int,
76
- ) -> AsyncGenerator[None, None]:
65
+ ) -> Generator[None, None, None]:
77
66
  os.environ["DRAGONFLY_PORT"] = str(dragonfly_port)
78
- await dragonfly_docker_services.start(
67
+ dragonfly_docker_services.start(
79
68
  name=default_dragonfly_service_name,
80
69
  docker_compose_files=dragonfly_docker_compose_files,
81
- check=dragonfly_responsive,
70
+ check=redis_responsive,
82
71
  port=dragonfly_port,
83
72
  )
84
73
  yield