pytest-databases 0.14.0__tar.gz → 0.15.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_databases-0.14.0 → pytest_databases-0.15.0}/.github/workflows/cd.yaml +1 -1
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.github/workflows/ci.yaml +6 -6
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.github/workflows/docs.yml +3 -3
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.github/workflows/pr-title.yaml +1 -1
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.github/workflows/release.yaml +1 -1
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.pre-commit-config.yaml +2 -2
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/PKG-INFO +3 -3
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/README.md +2 -2
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/postgres.rst +7 -6
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/pyproject.toml +5 -6
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/_service.py +20 -4
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/postgres.py +37 -1
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/redis.py +0 -6
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_postgres.py +2 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_redis.py +21 -10
- pytest_databases-0.15.0/uv.lock +3761 -0
- pytest_databases-0.14.0/uv.lock +0 -3486
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.github/CODEOWNERS +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.github/dependabot.yaml +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.gitignore +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.sourcery.yaml +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.vscode/launch.json +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/.vscode/settings.json +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/CODEOWNERS +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/CONTRIBUTING.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/LICENSE +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/Makefile +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/.gitignore +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/__init__.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/_static/.gitkeep +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/_static/custom.css +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/_static/logo.svg +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/changelog.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/conf.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/contribution-guide.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/getting-started/basic-usage.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/getting-started/configuration.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/getting-started/enabling-plugins.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/getting-started/index.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/getting-started/installation.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/getting-started/next-steps.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/index.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/azure_blob_storage.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/bigquery.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/cockroachdb.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/elasticsearch.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/index.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/mariadb.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/minio.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/mysql.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/oracle.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/redis.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/spanner.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/sqlserver.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/docs/supported-databases/valkey.rst +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/scripts/__init__.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/scripts/build_docs.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/scripts/convert_docs.sh +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/scripts/install-hatch.sh +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/sonar-project.properties +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/__init__.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/__metadata__.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/__init__.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/azure_blob.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/bigquery.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/cockroachdb.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/elastic_search.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/mariadb.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/minio.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/mssql.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/mysql.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/oracle.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/spanner.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/docker/valkey.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/helpers.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/py.typed +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/src/pytest_databases/types.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/__init__.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/conftest.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_azure_blob.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_bigquery.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_cockroachdb.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_elasticsearch.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_mariadb.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_minio.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_mssql.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_mysql.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_oracle.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_spanner.py +0 -0
- {pytest_databases-0.14.0 → pytest_databases-0.15.0}/tests/test_valkey.py +0 -0
|
@@ -26,13 +26,13 @@ jobs:
|
|
|
26
26
|
cdist-group: [1, 2, 3]
|
|
27
27
|
|
|
28
28
|
steps:
|
|
29
|
-
- uses: actions/checkout@
|
|
29
|
+
- uses: actions/checkout@v5
|
|
30
30
|
|
|
31
31
|
- name: Install additional dependencies
|
|
32
32
|
run: sudo apt-get update && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 libmariadb-dev && sudo apt-get autoremove -y && sudo apt-get clean -y
|
|
33
33
|
|
|
34
34
|
- name: Set up Python ${{ matrix.python-version }}
|
|
35
|
-
uses: actions/setup-python@
|
|
35
|
+
uses: actions/setup-python@v6
|
|
36
36
|
with:
|
|
37
37
|
python-version: ${{ matrix.python-version }}
|
|
38
38
|
|
|
@@ -58,7 +58,7 @@ jobs:
|
|
|
58
58
|
|
|
59
59
|
- if: matrix.python-version == '3.12'
|
|
60
60
|
name: Upload coverage reports to Codecov
|
|
61
|
-
uses: codecov/codecov-action@v5.
|
|
61
|
+
uses: codecov/codecov-action@v5.5.1
|
|
62
62
|
with:
|
|
63
63
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
64
64
|
slug: litestar-org/pytest-databases
|
|
@@ -70,10 +70,10 @@ jobs:
|
|
|
70
70
|
- name: Install additional dependencies
|
|
71
71
|
run: sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 libmariadb-dev
|
|
72
72
|
|
|
73
|
-
- uses: actions/checkout@
|
|
73
|
+
- uses: actions/checkout@v5
|
|
74
74
|
|
|
75
75
|
- name: Set up Python
|
|
76
|
-
uses: actions/setup-python@
|
|
76
|
+
uses: actions/setup-python@v6
|
|
77
77
|
with:
|
|
78
78
|
python-version: 3.9
|
|
79
79
|
|
|
@@ -94,7 +94,7 @@ jobs:
|
|
|
94
94
|
# runs-on: ubuntu-latest
|
|
95
95
|
# steps:
|
|
96
96
|
# - name: Check out repository
|
|
97
|
-
# uses: actions/checkout@
|
|
97
|
+
# uses: actions/checkout@v5
|
|
98
98
|
# with:
|
|
99
99
|
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
|
100
100
|
# - name: Download Artifacts
|
|
@@ -20,13 +20,13 @@ jobs:
|
|
|
20
20
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
21
21
|
runs-on: ubuntu-latest
|
|
22
22
|
steps:
|
|
23
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@v5
|
|
24
24
|
|
|
25
25
|
- name: Install additional dependencies
|
|
26
26
|
run: sudo apt-get update && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 libmariadb-dev && sudo apt-get autoremove -y && sudo apt-get clean -y
|
|
27
27
|
|
|
28
28
|
- name: Set up Python ${{ matrix.python-version }}
|
|
29
|
-
uses: actions/setup-python@
|
|
29
|
+
uses: actions/setup-python@v6
|
|
30
30
|
with:
|
|
31
31
|
python-version: 3.12
|
|
32
32
|
|
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
run: uv run scripts/build_docs.py dist/docs
|
|
44
44
|
|
|
45
45
|
- name: Upload artifact
|
|
46
|
-
uses: actions/upload-pages-artifact@
|
|
46
|
+
uses: actions/upload-pages-artifact@v4
|
|
47
47
|
with:
|
|
48
48
|
path: dist/docs/
|
|
49
49
|
|
|
@@ -2,7 +2,7 @@ exclude: "^docs/conf.py"
|
|
|
2
2
|
|
|
3
3
|
repos:
|
|
4
4
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
-
rev:
|
|
5
|
+
rev: v6.0.0
|
|
6
6
|
hooks:
|
|
7
7
|
- id: trailing-whitespace
|
|
8
8
|
- id: check-added-large-files
|
|
@@ -19,7 +19,7 @@ repos:
|
|
|
19
19
|
|
|
20
20
|
# Ruff replaces black, flake8, autoflake and isort
|
|
21
21
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
22
|
-
rev: "v0.
|
|
22
|
+
rev: "v0.13.3" # make sure this is always consistent with hatch configs
|
|
23
23
|
hooks:
|
|
24
24
|
- id: ruff
|
|
25
25
|
args: [--config, ./pyproject.toml]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-databases
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.15.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
|
|
@@ -84,7 +84,7 @@ Ready-made database fixtures for your pytest tests.
|
|
|
84
84
|
|
|
85
85
|
`pytest-databases` uses the Docker Python SDK to manage the startup and shutdown of database services in containers. The following databases are currently available:
|
|
86
86
|
|
|
87
|
-
- **Postgres**: Version 12, 13, 14, 15, 16 and
|
|
87
|
+
- **Postgres**: Version 12, 13, 14, 15, 16, 17 and 18 are available
|
|
88
88
|
- **MySQL**: Version 5.6, 5.7 and 8 are available
|
|
89
89
|
- **Oracle**: Version 18c XE and 23C Free are available
|
|
90
90
|
- **SQL Server**: Version 2022 is available
|
|
@@ -133,7 +133,7 @@ def test_one(postgres_service: PostgresService) -> None:
|
|
|
133
133
|
|
|
134
134
|
## Documentation
|
|
135
135
|
|
|
136
|
-
Full documentation is available at [https://
|
|
136
|
+
Full documentation is available at [https://litestar-org.github.io/pytest-databases/latest/](https://litestar-org.github.io/pytest-databases/latest/)
|
|
137
137
|
|
|
138
138
|
## Contributing
|
|
139
139
|
|
|
@@ -26,7 +26,7 @@ Ready-made database fixtures for your pytest tests.
|
|
|
26
26
|
|
|
27
27
|
`pytest-databases` uses the Docker Python SDK to manage the startup and shutdown of database services in containers. The following databases are currently available:
|
|
28
28
|
|
|
29
|
-
- **Postgres**: Version 12, 13, 14, 15, 16 and
|
|
29
|
+
- **Postgres**: Version 12, 13, 14, 15, 16, 17 and 18 are available
|
|
30
30
|
- **MySQL**: Version 5.6, 5.7 and 8 are available
|
|
31
31
|
- **Oracle**: Version 18c XE and 23C Free are available
|
|
32
32
|
- **SQL Server**: Version 2022 is available
|
|
@@ -75,7 +75,7 @@ def test_one(postgres_service: PostgresService) -> None:
|
|
|
75
75
|
|
|
76
76
|
## Documentation
|
|
77
77
|
|
|
78
|
-
Full documentation is available at [https://
|
|
78
|
+
Full documentation is available at [https://litestar-org.github.io/pytest-databases/latest/](https://litestar-org.github.io/pytest-databases/latest/)
|
|
79
79
|
|
|
80
80
|
## Contributing
|
|
81
81
|
|
|
@@ -8,7 +8,7 @@ Installation
|
|
|
8
8
|
|
|
9
9
|
.. code-block:: bash
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
pip install pytest-databases[postgres]
|
|
12
12
|
|
|
13
13
|
Usage Example
|
|
14
14
|
-------------
|
|
@@ -54,6 +54,7 @@ The following version-specific fixtures are also available:
|
|
|
54
54
|
* ``postgres_15_image``, ``postgres_15_service``, ``postgres_15_connection``: PostgreSQL 15.x
|
|
55
55
|
* ``postgres_16_image``, ``postgres_16_service``, ``postgres_16_connection``: PostgreSQL 16.x
|
|
56
56
|
* ``postgres_17_image``, ``postgres_17_service``, ``postgres_17_connection``: PostgreSQL 17.x
|
|
57
|
+
* ``postgres_18_image``, ``postgres_18_service``, ``postgres_18_connection``: PostgreSQL 18.x
|
|
57
58
|
* ``pgvector_image``, ``pgvector_service``. ``pgvector_connection``: Latest Available pgvector Docker image.
|
|
58
59
|
|
|
59
60
|
Configuration
|
|
@@ -67,13 +68,13 @@ Example usage with custom host:
|
|
|
67
68
|
|
|
68
69
|
.. code-block:: bash
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
export POSTGRES_HOST="192.168.1.100"
|
|
72
|
+
pytest
|
|
72
73
|
|
|
73
74
|
Service API
|
|
74
75
|
-----------
|
|
75
76
|
|
|
76
77
|
.. automodule:: pytest_databases.docker.postgres
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
:members:
|
|
79
|
+
:undoc-members:
|
|
80
|
+
:show-inheritance:
|
|
@@ -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.
|
|
15
|
+
version = "0.15.0"
|
|
16
16
|
#
|
|
17
17
|
authors = [{ name = "Cody Fincher", email = "cody@litestar.dev" }]
|
|
18
18
|
keywords = [
|
|
@@ -84,7 +84,6 @@ dev = [
|
|
|
84
84
|
"pytest-mock",
|
|
85
85
|
"pytest-click",
|
|
86
86
|
"pytest-xdist",
|
|
87
|
-
"pytest-sugar",
|
|
88
87
|
"slotscheck",
|
|
89
88
|
"psycopg-binary", # This fixes tests failing on M series CPUs.
|
|
90
89
|
# lint
|
|
@@ -123,12 +122,12 @@ dev = [
|
|
|
123
122
|
|
|
124
123
|
[tool.bumpversion]
|
|
125
124
|
allow_dirty = true
|
|
126
|
-
commit =
|
|
125
|
+
commit = false
|
|
127
126
|
commit_args = "--no-verify"
|
|
128
|
-
current_version = "0.
|
|
127
|
+
current_version = "0.15.0"
|
|
129
128
|
ignore_missing_files = false
|
|
130
129
|
ignore_missing_version = false
|
|
131
|
-
message = "chore(release): bump to v{new_version}"
|
|
130
|
+
message = "chore(release): bump to `v{new_version}`"
|
|
132
131
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
133
132
|
regex = false
|
|
134
133
|
replace = "{new_version}"
|
|
@@ -136,7 +135,7 @@ search = "{current_version}"
|
|
|
136
135
|
serialize = ["{major}.{minor}.{patch}"]
|
|
137
136
|
sign_tags = false
|
|
138
137
|
tag = false
|
|
139
|
-
tag_message = "chore(release): v{new_version}"
|
|
138
|
+
tag_message = "chore(release): `v{new_version}`"
|
|
140
139
|
tag_name = "v{new_version}"
|
|
141
140
|
|
|
142
141
|
[[tool.bumpversion.files]]
|
|
@@ -139,6 +139,7 @@ class DockerService(AbstractContextManager):
|
|
|
139
139
|
shm_size: int | None = None,
|
|
140
140
|
mem_limit: str | None = None,
|
|
141
141
|
platform: str | None = None,
|
|
142
|
+
protocol: str = "tcp",
|
|
142
143
|
) -> Generator[ServiceContainer, None, None]:
|
|
143
144
|
if check is None and wait_for_log is None:
|
|
144
145
|
msg = "Must set at least check or wait_for_log"
|
|
@@ -176,17 +177,32 @@ class DockerService(AbstractContextManager):
|
|
|
176
177
|
# spins it up and the metadata becomes available, so we're redoing the
|
|
177
178
|
# check with a small incremental backup here
|
|
178
179
|
for i in range(10):
|
|
180
|
+
container.reload()
|
|
179
181
|
if any(v for v in container.ports.values()):
|
|
180
182
|
break
|
|
181
|
-
container.reload()
|
|
182
183
|
time.sleep(0.1 + (i / 10))
|
|
183
184
|
else:
|
|
184
185
|
msg = f"Service {name!r} failed to create container"
|
|
185
186
|
raise ValueError(msg)
|
|
186
187
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
# Get port binding based on protocol configuration
|
|
189
|
+
binding = None
|
|
190
|
+
if protocol == "both":
|
|
191
|
+
binding = container.ports.get(f"{container_port}/tcp") or container.ports.get(f"{container_port}/udp")
|
|
192
|
+
elif protocol in {"tcp", "udp"}:
|
|
193
|
+
binding = container.ports.get(f"{container_port}/{protocol}")
|
|
194
|
+
else:
|
|
195
|
+
msg = f"Invalid protocol '{protocol}'. Must be 'tcp', 'udp', or 'both'."
|
|
196
|
+
raise ValueError(msg)
|
|
197
|
+
|
|
198
|
+
if not binding:
|
|
199
|
+
msg = (
|
|
200
|
+
f"Container port {container_port}/{protocol} not found in exposed ports. "
|
|
201
|
+
f"Available ports: {list(container.ports.keys())}"
|
|
202
|
+
)
|
|
203
|
+
raise RuntimeError(msg)
|
|
204
|
+
|
|
205
|
+
host_port = int(binding[0]["HostPort"])
|
|
190
206
|
service = ServiceContainer(
|
|
191
207
|
host=container_host,
|
|
192
208
|
port=host_port,
|
|
@@ -244,6 +244,26 @@ def postgres_17_service(
|
|
|
244
244
|
yield service
|
|
245
245
|
|
|
246
246
|
|
|
247
|
+
@pytest.fixture(autouse=False, scope="session")
|
|
248
|
+
def postgres_18_service(
|
|
249
|
+
docker_service: DockerService,
|
|
250
|
+
xdist_postgres_isolation_level: XdistIsolationLevel,
|
|
251
|
+
postgres_host: str,
|
|
252
|
+
postgres_user: str,
|
|
253
|
+
postgres_password: str,
|
|
254
|
+
) -> Generator[PostgresService, None, None]:
|
|
255
|
+
with _provide_postgres_service(
|
|
256
|
+
docker_service,
|
|
257
|
+
image="postgres:18",
|
|
258
|
+
name="postgres-18",
|
|
259
|
+
xdist_postgres_isolate=xdist_postgres_isolation_level,
|
|
260
|
+
host=postgres_host,
|
|
261
|
+
user=postgres_user,
|
|
262
|
+
password=postgres_password,
|
|
263
|
+
) as service:
|
|
264
|
+
yield service
|
|
265
|
+
|
|
266
|
+
|
|
247
267
|
@pytest.fixture(autouse=False, scope="session")
|
|
248
268
|
def postgres_11_connection(
|
|
249
269
|
postgres_11_service: PostgresService,
|
|
@@ -356,9 +376,25 @@ def postgres_17_connection(
|
|
|
356
376
|
yield conn
|
|
357
377
|
|
|
358
378
|
|
|
379
|
+
@pytest.fixture(autouse=False, scope="session")
|
|
380
|
+
def postgres_18_connection(
|
|
381
|
+
postgres_18_service: PostgresService,
|
|
382
|
+
) -> Generator[psycopg.Connection, None, None]:
|
|
383
|
+
with psycopg.connect(
|
|
384
|
+
_make_connection_string(
|
|
385
|
+
host=postgres_18_service.host,
|
|
386
|
+
port=postgres_18_service.port,
|
|
387
|
+
user=postgres_18_service.user,
|
|
388
|
+
password=postgres_18_service.password,
|
|
389
|
+
database=postgres_18_service.database,
|
|
390
|
+
),
|
|
391
|
+
) as conn:
|
|
392
|
+
yield conn
|
|
393
|
+
|
|
394
|
+
|
|
359
395
|
@pytest.fixture(autouse=False, scope="session")
|
|
360
396
|
def postgres_image() -> str:
|
|
361
|
-
return "postgres:
|
|
397
|
+
return "postgres:18"
|
|
362
398
|
|
|
363
399
|
|
|
364
400
|
@pytest.fixture(autouse=False, scope="session")
|
|
@@ -62,8 +62,6 @@ def redis_service(
|
|
|
62
62
|
db = 0
|
|
63
63
|
if worker_num is not None:
|
|
64
64
|
if xdist_redis_isolation_level == "database":
|
|
65
|
-
container_num = worker_num // 1
|
|
66
|
-
name += f"_{container_num + 1}"
|
|
67
65
|
db = worker_num
|
|
68
66
|
else:
|
|
69
67
|
name += f"_{worker_num + 1}"
|
|
@@ -94,8 +92,6 @@ def dragonfly_service(
|
|
|
94
92
|
db = 0
|
|
95
93
|
if worker_num is not None:
|
|
96
94
|
if xdist_redis_isolation_level == "database":
|
|
97
|
-
container_num = worker_num // 1
|
|
98
|
-
name += f"_{container_num + 1}"
|
|
99
95
|
db = worker_num
|
|
100
96
|
else:
|
|
101
97
|
name += f"_{worker_num + 1}"
|
|
@@ -136,8 +132,6 @@ def keydb_service(
|
|
|
136
132
|
db = 0
|
|
137
133
|
if worker_num is not None:
|
|
138
134
|
if xdist_redis_isolation_level == "database":
|
|
139
|
-
container_num = worker_num // 1
|
|
140
|
-
name += f"_{container_num + 1}"
|
|
141
135
|
db = worker_num
|
|
142
136
|
else:
|
|
143
137
|
name += f"_{worker_num + 1}"
|
|
@@ -13,6 +13,7 @@ import pytest
|
|
|
13
13
|
"postgres_15_service",
|
|
14
14
|
"postgres_16_service",
|
|
15
15
|
"postgres_17_service",
|
|
16
|
+
"postgres_18_service",
|
|
16
17
|
"alloydb_omni_service",
|
|
17
18
|
"pgvector_service",
|
|
18
19
|
],
|
|
@@ -57,6 +58,7 @@ def test_service_fixture(pytester: pytest.Pytester, service_fixture: str) -> Non
|
|
|
57
58
|
"postgres_15_connection",
|
|
58
59
|
"postgres_16_connection",
|
|
59
60
|
"postgres_17_connection",
|
|
61
|
+
"postgres_18_connection",
|
|
60
62
|
"alloydb_omni_connection",
|
|
61
63
|
"pgvector_connection",
|
|
62
64
|
],
|
|
@@ -46,7 +46,7 @@ def redis_image():
|
|
|
46
46
|
return "{redis_image_name}"
|
|
47
47
|
|
|
48
48
|
def test_redis_service(redis_service: RedisService) -> None:
|
|
49
|
-
assert redis.Redis
|
|
49
|
+
assert redis.Redis(host=redis_service.host, port=redis_service.port).ping()
|
|
50
50
|
""")
|
|
51
51
|
result = pytester.runpytest()
|
|
52
52
|
result.assert_outcomes(passed=1)
|
|
@@ -64,7 +64,7 @@ pytest_plugins = [
|
|
|
64
64
|
]
|
|
65
65
|
|
|
66
66
|
def test_redis_service({redis_compatible_service}: RedisService) -> None:
|
|
67
|
-
assert redis.Redis
|
|
67
|
+
assert redis.Redis(host={redis_compatible_service}.host, port={redis_compatible_service}.port).ping()
|
|
68
68
|
""")
|
|
69
69
|
result = pytester.runpytest()
|
|
70
70
|
result.assert_outcomes(passed=1)
|
|
@@ -82,20 +82,31 @@ pytest_plugins = [
|
|
|
82
82
|
]
|
|
83
83
|
|
|
84
84
|
def test_one({redis_compatible_service}: RedisService) -> None:
|
|
85
|
-
client = redis.Redis
|
|
86
|
-
assert not client.get("one")
|
|
87
|
-
client.set("one", "1")
|
|
85
|
+
client = redis.Redis(host={redis_compatible_service}.host, port={redis_compatible_service}.port, db={redis_compatible_service}.db)
|
|
88
86
|
assert {redis_compatible_service}.db == get_xdist_worker_num()
|
|
87
|
+
assert not client.get("one")
|
|
88
|
+
client.set("one", "0")
|
|
89
|
+
assert client.get("one") == b"0"
|
|
89
90
|
|
|
90
91
|
|
|
91
92
|
def test_two({redis_compatible_service}: RedisService) -> None:
|
|
92
|
-
client = redis.Redis
|
|
93
|
+
client = redis.Redis(host={redis_compatible_service}.host, port={redis_compatible_service}.port, db={redis_compatible_service}.db)
|
|
94
|
+
assert {redis_compatible_service}.db == get_xdist_worker_num()
|
|
93
95
|
assert not client.get("one")
|
|
94
96
|
client.set("one", "1")
|
|
95
|
-
assert
|
|
97
|
+
assert client.get("one") == b"1"
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_use_same_db({redis_compatible_service}: RedisService) -> None:
|
|
101
|
+
client_0 = redis.Redis(host={redis_compatible_service}.host, port={redis_compatible_service}.port, db=0)
|
|
102
|
+
client_1 = redis.Redis(host={redis_compatible_service}.host, port={redis_compatible_service}.port, db=1)
|
|
103
|
+
client_0.set("foo", "0")
|
|
104
|
+
client_1.set("foo", "1")
|
|
105
|
+
assert client_0.get("foo") == b"0"
|
|
106
|
+
assert client_1.get("foo") == b"1"
|
|
96
107
|
""")
|
|
97
108
|
result = pytester.runpytest("-n", "2")
|
|
98
|
-
result.assert_outcomes(passed=
|
|
109
|
+
result.assert_outcomes(passed=3)
|
|
99
110
|
|
|
100
111
|
|
|
101
112
|
def test_xdist_isolate_server(pytester: pytest.Pytester, redis_compatible_service: str) -> None:
|
|
@@ -115,14 +126,14 @@ def xdist_redis_isolation_level():
|
|
|
115
126
|
|
|
116
127
|
|
|
117
128
|
def test_one({redis_compatible_service}: RedisService) -> None:
|
|
118
|
-
client = redis.Redis
|
|
129
|
+
client = redis.Redis(host={redis_compatible_service}.host, port={redis_compatible_service}.port, db={redis_compatible_service}.db)
|
|
119
130
|
assert not client.get("one")
|
|
120
131
|
client.set("one", "1")
|
|
121
132
|
assert {redis_compatible_service}.db == 0
|
|
122
133
|
|
|
123
134
|
|
|
124
135
|
def test_two({redis_compatible_service}: RedisService) -> None:
|
|
125
|
-
client = redis.Redis
|
|
136
|
+
client = redis.Redis(host={redis_compatible_service}.host, port={redis_compatible_service}.port, db={redis_compatible_service}.db)
|
|
126
137
|
assert not client.get("one")
|
|
127
138
|
client.set("one", "1")
|
|
128
139
|
assert {redis_compatible_service}.db == 0
|