pytest-databases 0.6.0__tar.gz → 0.7.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 (82) hide show
  1. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/Makefile +4 -9
  2. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/PKG-INFO +1 -1
  3. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/pyproject.toml +2 -8
  4. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/scripts/build_docs.py +0 -23
  5. pytest_databases-0.7.0/scripts/install-hatch.sh +56 -0
  6. pytest_databases-0.7.0/src/pytest_databases/__init__.py +3 -0
  7. pytest_databases-0.7.0/src/pytest_databases/__metadata__.py +16 -0
  8. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/__init__.py +0 -23
  9. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/alloydb_omni.py +22 -23
  10. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/azure_blob.py +0 -21
  11. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/bigquery.py +12 -23
  12. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/cockroachdb.py +26 -27
  13. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.cockroachdb.yml +7 -3
  14. pytest_databases-0.7.0/src/pytest_databases/docker/docker-compose.valkey.yml +8 -0
  15. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/dragonfly.py +0 -23
  16. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/elastic_search.py +0 -23
  17. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/keydb.py +0 -23
  18. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/mariadb.py +39 -24
  19. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/mssql.py +40 -27
  20. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/mysql.py +77 -24
  21. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/oracle.py +57 -23
  22. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/postgres.py +134 -25
  23. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/redis.py +0 -23
  24. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/spanner.py +10 -23
  25. pytest_databases-0.7.0/src/pytest_databases/docker/valkey.py +85 -0
  26. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/helpers.py +0 -23
  27. pytest_databases-0.7.0/src/pytest_databases/py.typed +0 -0
  28. pytest_databases-0.7.0/tests/__init__.py +0 -0
  29. pytest_databases-0.7.0/tests/conftest.py +17 -0
  30. pytest_databases-0.7.0/tests/docker/__init__.py +0 -0
  31. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_alloydb_omni.py +10 -22
  32. pytest_databases-0.7.0/tests/docker/test_azure_blob.py +13 -0
  33. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_bigquery.py +7 -22
  34. pytest_databases-0.7.0/tests/docker/test_cockroachdb.py +46 -0
  35. pytest_databases-0.7.0/tests/docker/test_dragonfly.py +28 -0
  36. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_elasticsearch.py +0 -23
  37. pytest_databases-0.7.0/tests/docker/test_keydb.py +28 -0
  38. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_mariadb.py +21 -23
  39. pytest_databases-0.7.0/tests/docker/test_mssql.py +93 -0
  40. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_mysql.py +41 -23
  41. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_oracle.py +30 -23
  42. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_postgres.py +50 -22
  43. pytest_databases-0.7.0/tests/docker/test_redis.py +28 -0
  44. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/tests/docker/test_spanner.py +7 -22
  45. pytest_databases-0.7.0/tests/docker/test_valkey.py +28 -0
  46. pytest_databases-0.6.0/scripts/__init__.py +0 -21
  47. pytest_databases-0.6.0/src/pytest_databases/__init__.py +0 -21
  48. pytest_databases-0.6.0/src/pytest_databases/__metadata__.py +0 -39
  49. pytest_databases-0.6.0/tests/__init__.py +0 -21
  50. pytest_databases-0.6.0/tests/conftest.py +0 -40
  51. pytest_databases-0.6.0/tests/docker/__init__.py +0 -21
  52. pytest_databases-0.6.0/tests/docker/test_azure_blob.py +0 -35
  53. pytest_databases-0.6.0/tests/docker/test_cockroachdb.py +0 -59
  54. pytest_databases-0.6.0/tests/docker/test_dragonfly.py +0 -51
  55. pytest_databases-0.6.0/tests/docker/test_keydb.py +0 -51
  56. pytest_databases-0.6.0/tests/docker/test_mssql.py +0 -112
  57. pytest_databases-0.6.0/tests/docker/test_redis.py +0 -51
  58. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/.gitignore +0 -0
  59. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/.pre-commit-config.yaml +0 -0
  60. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/.sourcery.yaml +0 -0
  61. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/.vscode/launch.json +0 -0
  62. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/.vscode/settings.json +0 -0
  63. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/CODEOWNERS +0 -0
  64. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/CONTRIBUTING.rst +0 -0
  65. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/LICENSE +0 -0
  66. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/README.md +0 -0
  67. /pytest_databases-0.6.0/src/pytest_databases/py.typed → /pytest_databases-0.7.0/scripts/__init__.py +0 -0
  68. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/scripts/convert_docs.sh +0 -0
  69. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/sonar-project.properties +0 -0
  70. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.alloydb-omni.yml +0 -0
  71. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.azurite.yml +0 -0
  72. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.bigquery.yml +0 -0
  73. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.dragonfly.yml +0 -0
  74. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.elasticsearch.yml +0 -0
  75. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.keydb.yml +0 -0
  76. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.mariadb.yml +0 -0
  77. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.mssql.yml +0 -0
  78. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.mysql.yml +0 -0
  79. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.oracle.yml +0 -0
  80. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.postgres.yml +0 -0
  81. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.redis.yml +0 -0
  82. {pytest_databases-0.6.0 → pytest_databases-0.7.0}/src/pytest_databases/docker/docker-compose.spanner.yml +0 -0
@@ -20,25 +20,20 @@ help: ## Display this help
20
20
  # =============================================================================
21
21
  # Developer Utils
22
22
  # =============================================================================
23
- install-pipx: ## Install pipx
24
- @python3 -m pip install --upgrade --user pipx
25
-
26
- install-hatch: ## Install Hatch, UV, and Ruff
27
- @pipx install hatch --force
28
- @pipx inject hatch ruff uv hatch-pip-compile hatch-vcs hatch-mypyc mypy --include-deps --include-apps --force
23
+ install-hatch: ## Install Hatch
24
+ @sh ./scripts/install-hatch.sh
29
25
 
30
26
  configure-hatch: ## Configure Hatch defaults
31
27
  @hatch config set dirs.env.virtual .direnv
32
28
  @hatch config set dirs.env.pip-compile .direnv
33
29
 
34
30
  upgrade-hatch: ## Update Hatch, UV, and Ruff
35
- @pipx upgrade hatch --include-injected
31
+ @hatch self update
36
32
 
37
33
  install: ## Install the project and all dependencies
38
34
  @if [ "$(VENV_EXISTS)" ]; then echo "=> Removing existing virtual environment"; $(MAKE) destroy-venv; fi
39
35
  @$(MAKE) clean
40
- @if ! pipx --version > /dev/null; then echo '=> Installing `pipx`'; $(MAKE) install-pipx ; fi
41
- @if ! hatch --version > /dev/null; then echo '=> Installing `hatch` with `pipx`'; $(MAKE) install-hatch ; fi
36
+ @if ! hatch --version > /dev/null; then echo '=> Installing `hatch` with standalone installation'; $(MAKE) install-hatch ; fi
42
37
  @if ! hatch-pip-compile --version > /dev/null; then echo '=> Updating `hatch` and installing plugins'; $(MAKE) upgrade-hatch ; fi
43
38
  @echo "=> Creating Python environments..."
44
39
  @$(MAKE) configure-hatch
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-databases
3
- Version: 0.6.0
3
+ Version: 0.7.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
@@ -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.6.0"
15
+ version = "0.7.0"
16
16
  #
17
17
  authors = [{ name = "Cody Fincher", email = "cody.fincher@gmail.com" }]
18
18
  keywords = [
@@ -84,9 +84,6 @@ exclude = ["/.github", "/docs"]
84
84
  installer = "uv"
85
85
  python = "3.12"
86
86
 
87
- [tool.hatch.envs.default.scripts]
88
- upgrade-all = "PIP_COMPILE_UPGRADE=1 hatch env run --env {env_name} -- python --version"
89
- upgrade-pkg = "PIP_COMPILE_UPGRADE='{args}' hatch env run --env {env_name} -- python --version"
90
87
 
91
88
  # Test environment with test-only dependencies
92
89
  [tool.hatch.envs.test]
@@ -517,6 +514,7 @@ lint.ignore = [
517
514
  "PERF203", # ignore for now; investigate
518
515
  "COM812",
519
516
  "PLR0917",
517
+ "CPY001", # copywrite check
520
518
  ]
521
519
  lint.select = ["ALL"]
522
520
  # Allow unused variables when underscore-prefixed.
@@ -556,10 +554,6 @@ ban-relative-imports = "all"
556
554
  "FA102",
557
555
  ]
558
556
 
559
- # copyright
560
- # Enable once this is released: https://github.com/astral-sh/ruff/issues/10021
561
- # Ruff v0.3.4 has not included this release yet
562
- # "**/*.py" = ["CPY001"]
563
557
 
564
558
  [tool.ruff.lint.mccabe]
565
559
  max-complexity = 12
@@ -1,26 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import argparse
@@ -0,0 +1,56 @@
1
+ #!/bin/bash
2
+
3
+ # --- Constants ---
4
+ BASE_URL="https://github.com/pypa/hatch/releases/latest/download"
5
+ EXTRACT_CMD="tar -xzf"
6
+
7
+ # --- Handle Optional Installation Directory ---
8
+ INSTALL_DIR="$1" # Default: current directory
9
+ if [[ -n "$INSTALL_DIR" ]]; then
10
+ if [[ ! -d "$INSTALL_DIR" ]]; then # Check if directory exists
11
+ INSTALL_DIR="$HOME/.local/bin"
12
+ echo "Error: Invalid install directory '$INSTALL_DIR'"
13
+ exit 1
14
+ fi
15
+ INSTALL_DIR=$(realpath "$INSTALL_DIR") # Get absolute path
16
+ fi
17
+
18
+ # --- Determine Platform ---
19
+ PLATFORM=$(uname -s)
20
+ MACHINE=$(uname -m)
21
+ FILE_EXT="tar.gz"
22
+
23
+ if [[ $PLATFORM == "Darwin" ]]; then
24
+ PLATFORM_NAME="apple-darwin"
25
+ elif [[ $PLATFORM == "Linux" ]]; then
26
+ PLATFORM_NAME="unknown-linux-gnu"
27
+ if [[ $MACHINE == "aarch64" ]]; then
28
+ MACHINE="aarch64"
29
+ fi
30
+ elif [[ $PLATFORM == "Windows" ]]; then
31
+ PLATFORM_NAME="pc-windows-msvc"
32
+ FILE_EXT="zip"
33
+ EXTRACT_CMD="unzip"
34
+ else
35
+ echo "Unsupported platform: $PLATFORM"
36
+ exit 1
37
+ fi
38
+
39
+ # --- Construct File Name and URL ---
40
+ FILENAME="hatch-$MACHINE-$PLATFORM_NAME.$FILE_EXT"
41
+ URL="$BASE_URL/$FILENAME"
42
+
43
+ # --- Download and Extract ---
44
+ echo "Downloading Hatch binary: $FILENAME"
45
+ curl -L -o "$FILENAME" "$URL"
46
+
47
+ echo "Extracting to '$INSTALL_DIR'..."
48
+ $EXTRACT_CMD "$FILENAME" -C "$INSTALL_DIR" # Extract to install directory
49
+ rm "$FILENAME" # Remove archive
50
+
51
+ HATCH_BINARY="$INSTALL_DIR/hatch" # Path to the extracted binary
52
+ if [[ -x "$HATCH_BINARY" ]]; then
53
+ echo "Hatch binary successfully installed at '$HATCH_BINARY'"
54
+ else
55
+ echo "Error: Hatch binary not found or not executable."
56
+ fi
@@ -0,0 +1,3 @@
1
+ # SPDX-FileCopyrightText: 2024-present Litestar <hello@litestar.dev>
2
+ #
3
+ # SPDX-License-Identifier: MIT
@@ -0,0 +1,16 @@
1
+ from __future__ import annotations
2
+
3
+ from importlib.metadata import PackageNotFoundError, metadata, version
4
+
5
+ __all__ = ("__project__", "__version__")
6
+
7
+ try:
8
+ __version__ = version("pytest-databases")
9
+ """Version of the project."""
10
+ __project__ = metadata("pytest-databases")["Name"]
11
+ """Name of the project."""
12
+ except PackageNotFoundError: # pragma: no cover
13
+ __version__ = "0.0.0"
14
+ __project__ = "pytest-databases"
15
+ finally:
16
+ del version, PackageNotFoundError, metadata
@@ -1,26 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import asyncio
@@ -1,26 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import os
@@ -141,3 +118,25 @@ async def alloydb_omni_service(
141
118
  password=postgres_password,
142
119
  )
143
120
  yield
121
+
122
+
123
+ @pytest.fixture(autouse=False, scope="session")
124
+ async def alloydb_omni_startup_connection(
125
+ alloydb_omni_service: DockerServiceRegistry,
126
+ alloydb_docker_ip: str,
127
+ alloydb_omni_port: int,
128
+ postgres_database: str,
129
+ postgres_user: str,
130
+ postgres_password: str,
131
+ ) -> AsyncGenerator[asyncpg.Connection[asyncpg.Record], None]:
132
+ conn = await asyncpg.connect(
133
+ host=alloydb_docker_ip,
134
+ port=alloydb_omni_port,
135
+ user=postgres_user,
136
+ database=postgres_database,
137
+ password=postgres_password,
138
+ )
139
+ try:
140
+ yield conn
141
+ finally:
142
+ await conn.close()
@@ -1,24 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
1
  from __future__ import annotations
23
2
 
24
3
  import json
@@ -1,26 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import os
@@ -163,3 +140,15 @@ async def bigquery_service(
163
140
  bigquery_client_options=bigquery_client_options,
164
141
  )
165
142
  yield
143
+
144
+
145
+ @pytest.fixture(autouse=False, scope="session")
146
+ async def bigquery_startup_connection(
147
+ bigquery_service: DockerServiceRegistry,
148
+ bigquery_project: str,
149
+ bigquery_credentials: Credentials,
150
+ bigquery_client_options: ClientOptions,
151
+ ) -> AsyncGenerator[bigquery.Client, None]:
152
+ yield bigquery.Client(
153
+ project=bigquery_project, client_options=bigquery_client_options, credentials=bigquery_credentials
154
+ )
@@ -1,25 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
1
  from __future__ import annotations
24
2
 
25
3
  import os
@@ -27,7 +5,7 @@ import sys
27
5
  from pathlib import Path
28
6
  from typing import TYPE_CHECKING, AsyncGenerator
29
7
 
30
- import psycopg
8
+ import asyncpg
31
9
  import pytest
32
10
 
33
11
  from pytest_databases.docker import DockerServiceRegistry
@@ -43,13 +21,16 @@ COMPOSE_PROJECT_NAME: str = f"pytest-databases-cockroachdb-{simple_string_hash(_
43
21
  async def cockroachdb_responsive(host: str, port: int, database: str, driver_opts: dict[str, str]) -> bool:
44
22
  opts = "&".join(f"{k}={v}" for k, v in driver_opts.items()) if driver_opts else ""
45
23
  try:
46
- with psycopg.connect(f"postgresql://root@{host}:{port}/{database}?{opts}") as conn, conn.cursor() as cursor:
47
- cursor.execute("select 1 as is_available")
48
- resp = cursor.fetchone()
49
- return resp[0] if resp is not None else 0 == 1 # noqa: PLR0133
24
+ conn = await asyncpg.connect(f"postgresql://root@{host}:{port}/{database}?{opts}")
50
25
  except Exception: # noqa: BLE001
51
26
  return False
52
27
 
28
+ try:
29
+ db_open = await conn.fetchrow("SELECT 1")
30
+ return bool(db_open is not None and db_open[0] == 1)
31
+ finally:
32
+ await conn.close()
33
+
53
34
 
54
35
  @pytest.fixture(scope="session")
55
36
  def cockroachdb_compose_project_name() -> str:
@@ -122,3 +103,21 @@ async def cockroachdb_service(
122
103
  driver_opts=cockroachdb_driver_opts,
123
104
  )
124
105
  yield
106
+
107
+
108
+ @pytest.fixture(autouse=False, scope="session")
109
+ async def cockroachdb_startup_connection(
110
+ cockroachdb_service: DockerServiceRegistry,
111
+ cockroachdb_docker_ip: str,
112
+ cockroachdb_port: int,
113
+ cockroachdb_database: str,
114
+ cockroachdb_driver_opts: dict[str, str],
115
+ ) -> AsyncGenerator[asyncpg.Connection[asyncpg.Record], None]:
116
+ opts = "&".join(f"{k}={v}" for k, v in cockroachdb_driver_opts.items()) if cockroachdb_driver_opts else ""
117
+ conn = await asyncpg.connect(
118
+ f"postgresql://root@{cockroachdb_docker_ip}:{cockroachdb_port}/{cockroachdb_database}?{opts}"
119
+ )
120
+ try:
121
+ yield conn
122
+ finally:
123
+ await conn.close()
@@ -1,14 +1,16 @@
1
1
  services:
2
2
  cockroachdb:
3
- image: cockroachdb/cockroach:latest-v23.1
4
- command: start-single-node --insecure
3
+ image: cockroachdb/cockroach:latest
4
+ command: start-single-node --insecure --http-addr=cockroachdb:8080
5
5
  restart: "no"
6
6
  expose:
7
7
  - "8080"
8
8
  - "${COCKROACHDB_PORT:-26257}"
9
9
  ports:
10
10
  - "${COCKROACHDB_PORT:-26257}:26257"
11
- - "8880:8080"
11
+ - "${COCKROACHDB_WEB_PORT:-8880}:8080"
12
+ volumes:
13
+ - cockroach-data:/cockroach/cockroach-data/
12
14
  healthcheck:
13
15
  test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"]
14
16
  interval: 3s
@@ -17,3 +19,5 @@ services:
17
19
  networks:
18
20
  default:
19
21
  driver: bridge
22
+ volumes:
23
+ cockroach-data:
@@ -0,0 +1,8 @@
1
+ services:
2
+ valkey:
3
+ image: valkey/valkey
4
+ ports:
5
+ - "${VALKEY_PORT:-6308}:6379"
6
+ networks:
7
+ default:
8
+ driver: bridge
@@ -1,26 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import os
@@ -1,26 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import os
@@ -1,26 +1,3 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import os
@@ -1,33 +1,10 @@
1
- # MIT License
2
-
3
- # Copyright (c) 2024 Litestar
4
-
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
-
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
-
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
22
-
23
-
24
1
  from __future__ import annotations
25
2
 
26
3
  import contextlib
27
4
  import os
28
5
  import sys
29
6
  from pathlib import Path
30
- from typing import TYPE_CHECKING, AsyncGenerator
7
+ from typing import TYPE_CHECKING, Any, AsyncGenerator
31
8
 
32
9
  import asyncmy
33
10
  import pytest
@@ -185,3 +162,41 @@ async def mariadb_service(
185
162
  password=mariadb_password,
186
163
  )
187
164
  yield
165
+
166
+
167
+ @pytest.fixture(autouse=False, scope="session")
168
+ async def mariadb_startup_connection(
169
+ mariadb_service: DockerServiceRegistry,
170
+ mariadb_docker_ip: str,
171
+ mariadb_port: int,
172
+ mariadb_database: str,
173
+ mariadb_user: str,
174
+ mariadb_password: str,
175
+ ) -> AsyncGenerator[Any, None]:
176
+ conn = await asyncmy.connect(
177
+ host=mariadb_docker_ip,
178
+ port=mariadb_port,
179
+ user=mariadb_user,
180
+ database=mariadb_database,
181
+ password=mariadb_password,
182
+ )
183
+ yield conn
184
+
185
+
186
+ @pytest.fixture(autouse=False, scope="session")
187
+ async def mariadb113_startup_connection(
188
+ mariadb113_service: DockerServiceRegistry,
189
+ mariadb_docker_ip: str,
190
+ mariadb113_port: int,
191
+ mariadb_database: str,
192
+ mariadb_user: str,
193
+ mariadb_password: str,
194
+ ) -> AsyncGenerator[Any, None]:
195
+ conn = await asyncmy.connect(
196
+ host=mariadb_docker_ip,
197
+ port=mariadb113_port,
198
+ user=mariadb_user,
199
+ database=mariadb_database,
200
+ password=mariadb_password,
201
+ )
202
+ yield conn