pytest-databases 0.13.0__tar.gz → 0.14.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 (89) hide show
  1. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/PKG-INFO +1 -1
  2. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/postgres.rst +14 -0
  3. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/pyproject.toml +2 -2
  4. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/_service.py +2 -1
  5. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/postgres.py +28 -0
  6. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/uv.lock +1 -1
  7. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.github/CODEOWNERS +0 -0
  8. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.github/dependabot.yaml +0 -0
  9. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.github/workflows/cd.yaml +0 -0
  10. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.github/workflows/ci.yaml +0 -0
  11. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.github/workflows/docs.yml +0 -0
  12. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.github/workflows/pr-title.yaml +0 -0
  13. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.github/workflows/release.yaml +0 -0
  14. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.gitignore +0 -0
  15. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.pre-commit-config.yaml +0 -0
  16. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.sourcery.yaml +0 -0
  17. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.vscode/launch.json +0 -0
  18. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/.vscode/settings.json +0 -0
  19. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/CODEOWNERS +0 -0
  20. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/CONTRIBUTING.rst +0 -0
  21. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/LICENSE +0 -0
  22. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/Makefile +0 -0
  23. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/README.md +0 -0
  24. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/.gitignore +0 -0
  25. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/__init__.py +0 -0
  26. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/_static/.gitkeep +0 -0
  27. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/_static/custom.css +0 -0
  28. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/_static/logo.svg +0 -0
  29. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/changelog.rst +0 -0
  30. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/conf.py +0 -0
  31. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/contribution-guide.rst +0 -0
  32. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/getting-started/basic-usage.rst +0 -0
  33. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/getting-started/configuration.rst +0 -0
  34. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/getting-started/enabling-plugins.rst +0 -0
  35. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/getting-started/index.rst +0 -0
  36. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/getting-started/installation.rst +0 -0
  37. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/getting-started/next-steps.rst +0 -0
  38. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/index.rst +0 -0
  39. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/azure_blob_storage.rst +0 -0
  40. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/bigquery.rst +0 -0
  41. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/cockroachdb.rst +0 -0
  42. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/elasticsearch.rst +0 -0
  43. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/index.rst +0 -0
  44. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/mariadb.rst +0 -0
  45. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/minio.rst +0 -0
  46. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/mysql.rst +0 -0
  47. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/oracle.rst +0 -0
  48. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/redis.rst +0 -0
  49. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/spanner.rst +0 -0
  50. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/sqlserver.rst +0 -0
  51. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/docs/supported-databases/valkey.rst +0 -0
  52. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/scripts/__init__.py +0 -0
  53. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/scripts/build_docs.py +0 -0
  54. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/scripts/convert_docs.sh +0 -0
  55. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/scripts/install-hatch.sh +0 -0
  56. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/sonar-project.properties +0 -0
  57. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/__init__.py +0 -0
  58. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/__metadata__.py +0 -0
  59. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/__init__.py +0 -0
  60. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/azure_blob.py +0 -0
  61. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/bigquery.py +0 -0
  62. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/cockroachdb.py +0 -0
  63. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/elastic_search.py +0 -0
  64. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/mariadb.py +0 -0
  65. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/minio.py +0 -0
  66. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/mssql.py +0 -0
  67. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/mysql.py +0 -0
  68. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/oracle.py +0 -0
  69. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/redis.py +0 -0
  70. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/spanner.py +0 -0
  71. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/docker/valkey.py +0 -0
  72. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/helpers.py +0 -0
  73. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/py.typed +0 -0
  74. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/src/pytest_databases/types.py +0 -0
  75. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/__init__.py +0 -0
  76. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/conftest.py +0 -0
  77. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_azure_blob.py +0 -0
  78. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_bigquery.py +0 -0
  79. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_cockroachdb.py +0 -0
  80. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_elasticsearch.py +0 -0
  81. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_mariadb.py +0 -0
  82. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_minio.py +0 -0
  83. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_mssql.py +0 -0
  84. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_mysql.py +0 -0
  85. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_oracle.py +0 -0
  86. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_postgres.py +0 -0
  87. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_redis.py +0 -0
  88. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_spanner.py +0 -0
  89. {pytest_databases-0.13.0 → pytest_databases-0.14.0}/tests/test_valkey.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-databases
3
- Version: 0.13.0
3
+ Version: 0.14.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
@@ -36,6 +36,7 @@ Usage Example
36
36
  Available Fixtures
37
37
  ------------------
38
38
 
39
+ * ``postgres_host``: The PostgreSQL host address (defaults to "127.0.0.1", can be overridden with ``POSTGRES_HOST`` environment variable).
39
40
  * ``postgres_user``: The PostgreSQL user.
40
41
  * ``postgres_password``: The PostgreSQL password.
41
42
  * ``postgres_database``: The PostgreSQL database name to use.
@@ -55,6 +56,19 @@ The following version-specific fixtures are also available:
55
56
  * ``postgres_17_image``, ``postgres_17_service``, ``postgres_17_connection``: PostgreSQL 17.x
56
57
  * ``pgvector_image``, ``pgvector_service``. ``pgvector_connection``: Latest Available pgvector Docker image.
57
58
 
59
+ Configuration
60
+ -------------
61
+
62
+ PostgreSQL services can be configured using environment variables:
63
+
64
+ * ``POSTGRES_HOST``: The host address for the PostgreSQL container (default: "127.0.0.1")
65
+
66
+ Example usage with custom host:
67
+
68
+ .. code-block:: bash
69
+
70
+ export POSTGRES_HOST="192.168.1.100"
71
+ pytest
58
72
 
59
73
  Service API
60
74
  -----------
@@ -12,7 +12,7 @@ license = "MIT"
12
12
  name = "pytest-databases"
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.9"
15
- version = "0.13.0"
15
+ version = "0.14.0"
16
16
  #
17
17
  authors = [{ name = "Cody Fincher", email = "cody@litestar.dev" }]
18
18
  keywords = [
@@ -125,7 +125,7 @@ dev = [
125
125
  allow_dirty = true
126
126
  commit = true
127
127
  commit_args = "--no-verify"
128
- current_version = "0.13.0"
128
+ current_version = "0.14.0"
129
129
  ignore_missing_files = false
130
130
  ignore_missing_version = false
131
131
  message = "chore(release): bump to v{new_version}"
@@ -126,6 +126,7 @@ class DockerService(AbstractContextManager):
126
126
  image: str,
127
127
  container_port: int,
128
128
  name: str,
129
+ container_host: str = "127.0.0.1",
129
130
  command: str | None = None,
130
131
  env: dict[str, Any] | None = None,
131
132
  exec_after_start: str | list[str] | None = None,
@@ -187,7 +188,7 @@ class DockerService(AbstractContextManager):
187
188
  container.ports[next(k for k in container.ports if k.startswith(str(container_port)))][0]["HostPort"]
188
189
  )
189
190
  service = ServiceContainer(
190
- host="127.0.0.1",
191
+ host=container_host,
191
192
  port=host_port,
192
193
  )
193
194
 
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import dataclasses
4
+ import os
4
5
  from contextlib import contextmanager
5
6
  from typing import TYPE_CHECKING
6
7
 
@@ -32,6 +33,11 @@ class PostgresService(ServiceContainer):
32
33
  user: str
33
34
 
34
35
 
36
+ @pytest.fixture(autouse=False, scope="session")
37
+ def postgres_host() -> str:
38
+ return os.environ.get("POSTGRES_HOST", "127.0.0.1")
39
+
40
+
35
41
  @pytest.fixture(autouse=False, scope="session")
36
42
  def postgres_password() -> str:
37
43
  return "super-secret"
@@ -47,6 +53,7 @@ def _provide_postgres_service(
47
53
  docker_service: DockerService,
48
54
  image: str,
49
55
  name: str,
56
+ host: str,
50
57
  user: str,
51
58
  password: str,
52
59
  xdist_postgres_isolate: XdistIsolationLevel,
@@ -79,6 +86,7 @@ def _provide_postgres_service(
79
86
  with docker_service.run(
80
87
  image=image,
81
88
  check=check,
89
+ container_host=host,
82
90
  container_port=5432,
83
91
  name=name,
84
92
  env={
@@ -100,6 +108,7 @@ def _provide_postgres_service(
100
108
  def postgres_11_service(
101
109
  docker_service: DockerService,
102
110
  xdist_postgres_isolation_level: XdistIsolationLevel,
111
+ postgres_host: str,
103
112
  postgres_user: str,
104
113
  postgres_password: str,
105
114
  ) -> Generator[PostgresService, None, None]:
@@ -108,6 +117,7 @@ def postgres_11_service(
108
117
  image="postgres:11",
109
118
  name="postgres-11",
110
119
  xdist_postgres_isolate=xdist_postgres_isolation_level,
120
+ host=postgres_host,
111
121
  user=postgres_user,
112
122
  password=postgres_password,
113
123
  ) as service:
@@ -118,6 +128,7 @@ def postgres_11_service(
118
128
  def postgres_12_service(
119
129
  docker_service: DockerService,
120
130
  xdist_postgres_isolation_level: XdistIsolationLevel,
131
+ postgres_host: str,
121
132
  postgres_user: str,
122
133
  postgres_password: str,
123
134
  ) -> Generator[PostgresService, None, None]:
@@ -126,6 +137,7 @@ def postgres_12_service(
126
137
  image="postgres:12",
127
138
  name="postgres-12",
128
139
  xdist_postgres_isolate=xdist_postgres_isolation_level,
140
+ host=postgres_host,
129
141
  user=postgres_user,
130
142
  password=postgres_password,
131
143
  ) as service:
@@ -136,6 +148,7 @@ def postgres_12_service(
136
148
  def postgres_13_service(
137
149
  docker_service: DockerService,
138
150
  xdist_postgres_isolation_level: XdistIsolationLevel,
151
+ postgres_host: str,
139
152
  postgres_user: str,
140
153
  postgres_password: str,
141
154
  ) -> Generator[PostgresService, None, None]:
@@ -144,6 +157,7 @@ def postgres_13_service(
144
157
  image="postgres:13",
145
158
  name="postgres-13",
146
159
  xdist_postgres_isolate=xdist_postgres_isolation_level,
160
+ host=postgres_host,
147
161
  user=postgres_user,
148
162
  password=postgres_password,
149
163
  ) as service:
@@ -154,6 +168,7 @@ def postgres_13_service(
154
168
  def postgres_14_service(
155
169
  docker_service: DockerService,
156
170
  xdist_postgres_isolation_level: XdistIsolationLevel,
171
+ postgres_host: str,
157
172
  postgres_user: str,
158
173
  postgres_password: str,
159
174
  ) -> Generator[PostgresService, None, None]:
@@ -162,6 +177,7 @@ def postgres_14_service(
162
177
  image="postgres:14",
163
178
  name="postgres-14",
164
179
  xdist_postgres_isolate=xdist_postgres_isolation_level,
180
+ host=postgres_host,
165
181
  user=postgres_user,
166
182
  password=postgres_password,
167
183
  ) as service:
@@ -172,6 +188,7 @@ def postgres_14_service(
172
188
  def postgres_15_service(
173
189
  docker_service: DockerService,
174
190
  xdist_postgres_isolation_level: XdistIsolationLevel,
191
+ postgres_host: str,
175
192
  postgres_user: str,
176
193
  postgres_password: str,
177
194
  ) -> Generator[PostgresService, None, None]:
@@ -180,6 +197,7 @@ def postgres_15_service(
180
197
  image="postgres:15",
181
198
  name="postgres-15",
182
199
  xdist_postgres_isolate=xdist_postgres_isolation_level,
200
+ host=postgres_host,
183
201
  user=postgres_user,
184
202
  password=postgres_password,
185
203
  ) as service:
@@ -190,6 +208,7 @@ def postgres_15_service(
190
208
  def postgres_16_service(
191
209
  docker_service: DockerService,
192
210
  xdist_postgres_isolation_level: XdistIsolationLevel,
211
+ postgres_host: str,
193
212
  postgres_user: str,
194
213
  postgres_password: str,
195
214
  ) -> Generator[PostgresService, None, None]:
@@ -198,6 +217,7 @@ def postgres_16_service(
198
217
  image="postgres:16",
199
218
  name="postgres-16",
200
219
  xdist_postgres_isolate=xdist_postgres_isolation_level,
220
+ host=postgres_host,
201
221
  user=postgres_user,
202
222
  password=postgres_password,
203
223
  ) as service:
@@ -208,6 +228,7 @@ def postgres_16_service(
208
228
  def postgres_17_service(
209
229
  docker_service: DockerService,
210
230
  xdist_postgres_isolation_level: XdistIsolationLevel,
231
+ postgres_host: str,
211
232
  postgres_user: str,
212
233
  postgres_password: str,
213
234
  ) -> Generator[PostgresService, None, None]:
@@ -216,6 +237,7 @@ def postgres_17_service(
216
237
  image="postgres:17",
217
238
  name="postgres-17",
218
239
  xdist_postgres_isolate=xdist_postgres_isolation_level,
240
+ host=postgres_host,
219
241
  user=postgres_user,
220
242
  password=postgres_password,
221
243
  ) as service:
@@ -344,6 +366,7 @@ def postgres_service(
344
366
  docker_service: DockerService,
345
367
  postgres_image: str,
346
368
  xdist_postgres_isolation_level: XdistIsolationLevel,
369
+ postgres_host: str,
347
370
  postgres_user: str,
348
371
  postgres_password: str,
349
372
  ) -> Generator[PostgresService, None, None]:
@@ -352,6 +375,7 @@ def postgres_service(
352
375
  image=postgres_image,
353
376
  name="postgres",
354
377
  xdist_postgres_isolate=xdist_postgres_isolation_level,
378
+ host=postgres_host,
355
379
  user=postgres_user,
356
380
  password=postgres_password,
357
381
  ) as service:
@@ -384,6 +408,7 @@ def pgvector_service(
384
408
  docker_service: DockerService,
385
409
  pgvector_image: str,
386
410
  xdist_postgres_isolation_level: XdistIsolationLevel,
411
+ postgres_host: str,
387
412
  postgres_user: str,
388
413
  postgres_password: str,
389
414
  ) -> Generator[PostgresService, None, None]:
@@ -392,6 +417,7 @@ def pgvector_service(
392
417
  image=pgvector_image,
393
418
  name="pgvector",
394
419
  xdist_postgres_isolate=xdist_postgres_isolation_level,
420
+ host=postgres_host,
395
421
  user=postgres_user,
396
422
  password=postgres_password,
397
423
  ) as service:
@@ -424,6 +450,7 @@ def alloydb_omni_service(
424
450
  docker_service: DockerService,
425
451
  pgvector_image: str,
426
452
  xdist_postgres_isolation_level: XdistIsolationLevel,
453
+ postgres_host: str,
427
454
  postgres_user: str,
428
455
  postgres_password: str,
429
456
  ) -> Generator[PostgresService, None, None]:
@@ -432,6 +459,7 @@ def alloydb_omni_service(
432
459
  image=pgvector_image,
433
460
  name="alloydb-omni",
434
461
  xdist_postgres_isolate=xdist_postgres_isolation_level,
462
+ host=postgres_host,
435
463
  user=postgres_user,
436
464
  password=postgres_password,
437
465
  ) as service:
@@ -2010,7 +2010,7 @@ wheels = [
2010
2010
 
2011
2011
  [[package]]
2012
2012
  name = "pytest-databases"
2013
- version = "0.13.0"
2013
+ version = "0.14.0"
2014
2014
  source = { editable = "." }
2015
2015
  dependencies = [
2016
2016
  { name = "docker" },