pytest-databases 0.2.1__tar.gz → 0.2.3__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.2.1 → pytest_databases-0.2.3}/PKG-INFO +1 -1
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/pyproject.toml +1 -1
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/cockroachdb.py +27 -5
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/docker-compose.yml +49 -49
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/dragonfly.py +2 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/keydb.py +2 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/mariadb.py +22 -2
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/mssql.py +21 -14
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/mysql.py +48 -4
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/oracle.py +24 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/postgres.py +25 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/redis.py +2 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/spanner.py +61 -10
- pytest_databases-0.2.3/tests/docker/test_cockroachdb.py +57 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/tests/docker/test_keydb.py +2 -0
- pytest_databases-0.2.3/tests/docker/test_mariadb.py +99 -0
- pytest_databases-0.2.3/tests/docker/test_mssql.py +112 -0
- pytest_databases-0.2.3/tests/docker/test_mysql.py +159 -0
- pytest_databases-0.2.3/tests/docker/test_postgres.py +219 -0
- pytest_databases-0.2.3/tests/docker/test_spanner.py +68 -0
- pytest_databases-0.2.1/tests/docker/test_cockroachdb.py +0 -30
- pytest_databases-0.2.1/tests/docker/test_mssql.py +0 -30
- pytest_databases-0.2.1/tests/docker/test_mysql.py +0 -30
- pytest_databases-0.2.1/tests/docker/test_postgres.py +0 -25
- pytest_databases-0.2.1/tests/docker/test_spanner.py +0 -25
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/.gitignore +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/.pre-commit-config.yaml +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/.sourcery.yaml +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/.vscode/settings.json +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/CODEOWNERS +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/CONTRIBUTING.rst +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/LICENSE +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/Makefile +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/README.md +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/requirements/requirements-dev.txt +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/requirements/requirements-docs.txt +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/requirements/requirements.txt +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/scripts/__init__.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/scripts/build_docs.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/scripts/convert_docs.sh +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/sonar-project.properties +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/__init__.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/__metadata__.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/__init__.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/helpers.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/py.typed +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/tests/__init__.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/tests/conftest.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/tests/docker/__init__.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/tests/docker/test_dragonfly.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/tests/docker/test_oracle.py +0 -0
- {pytest_databases-0.2.1 → pytest_databases-0.2.3}/tests/docker/test_redis.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytest-databases
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
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
|
{pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/cockroachdb.py
RENAMED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
# SOFTWARE.
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
from __future__ import annotations
|
|
25
24
|
|
|
25
|
+
import os
|
|
26
26
|
from typing import TYPE_CHECKING
|
|
27
27
|
|
|
28
28
|
import psycopg
|
|
@@ -44,13 +44,35 @@ async def cockroachdb_responsive(host: str, port: int, database: str, driver_opt
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
@pytest.fixture()
|
|
47
|
-
|
|
47
|
+
def cockroachdb_port() -> int:
|
|
48
|
+
return 26257
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@pytest.fixture()
|
|
52
|
+
def cockroachdb_database() -> str:
|
|
53
|
+
return "defaultdb"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@pytest.fixture()
|
|
57
|
+
def cockroachdb_driver_opts() -> dict[str, str]:
|
|
58
|
+
return {"sslmode": "disable"}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@pytest.fixture(autouse=False)
|
|
62
|
+
async def cockroachdb_service(
|
|
63
|
+
docker_services: DockerServiceRegistry,
|
|
64
|
+
cockroachdb_port: int,
|
|
65
|
+
cockroachdb_database: str,
|
|
66
|
+
cockroachdb_driver_opts: dict[str, str],
|
|
67
|
+
) -> None:
|
|
68
|
+
os.environ["COCKROACHDB_DATABASE"] = cockroachdb_database
|
|
69
|
+
os.environ["COCKROACHDB_PORT"] = str(cockroachdb_port)
|
|
48
70
|
await docker_services.start(
|
|
49
71
|
"cockroachdb",
|
|
50
72
|
timeout=60,
|
|
51
73
|
pause=1,
|
|
52
74
|
check=cockroachdb_responsive,
|
|
53
|
-
port=
|
|
54
|
-
database=
|
|
55
|
-
driver_opts=
|
|
75
|
+
port=cockroachdb_port,
|
|
76
|
+
database=cockroachdb_database,
|
|
77
|
+
driver_opts=cockroachdb_driver_opts,
|
|
56
78
|
)
|
{pytest_databases-0.2.1 → pytest_databases-0.2.3}/src/pytest_databases/docker/docker-compose.yml
RENAMED
|
@@ -4,52 +4,52 @@ services:
|
|
|
4
4
|
- default
|
|
5
5
|
image: postgres:12
|
|
6
6
|
ports:
|
|
7
|
-
- "5423:5432" # use a non-standard port here
|
|
7
|
+
- "${POSTGRES12_PORT:-5423}:5432" # use a non-standard port here
|
|
8
8
|
environment:
|
|
9
|
-
POSTGRES_PASSWORD: super-secret
|
|
9
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
|
|
10
10
|
postgres13:
|
|
11
11
|
networks:
|
|
12
12
|
- default
|
|
13
13
|
image: postgres:13
|
|
14
14
|
ports:
|
|
15
|
-
- "5424:5432" # use a non-standard port here
|
|
15
|
+
- "${POSTGRES13_PORT:-5424}:5432" # use a non-standard port here
|
|
16
16
|
environment:
|
|
17
|
-
POSTGRES_PASSWORD: super-secret
|
|
17
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
|
|
18
18
|
postgres14:
|
|
19
19
|
networks:
|
|
20
20
|
- default
|
|
21
21
|
image: postgres:14
|
|
22
22
|
ports:
|
|
23
|
-
- "5425:5432" # use a non-standard port here
|
|
23
|
+
- "${POSTGRES14_PORT:-5425}:5432" # use a non-standard port here
|
|
24
24
|
environment:
|
|
25
|
-
POSTGRES_PASSWORD: super-secret
|
|
25
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
|
|
26
26
|
postgres15:
|
|
27
27
|
networks:
|
|
28
28
|
- default
|
|
29
29
|
image: postgres:15
|
|
30
30
|
ports:
|
|
31
|
-
- "5426:5432" # use a non-standard port here
|
|
31
|
+
- "${POSTGRES15_PORT:-5426}:5432" # use a non-standard port here
|
|
32
32
|
environment:
|
|
33
|
-
POSTGRES_PASSWORD: super-secret
|
|
33
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
|
|
34
34
|
postgres16:
|
|
35
35
|
networks:
|
|
36
36
|
- default
|
|
37
37
|
image: postgres:16
|
|
38
38
|
ports:
|
|
39
|
-
- "5427:5432" # use a non-standard port here
|
|
39
|
+
- "${POSTGRES16_PORT:-5427}:5432" # use a non-standard port here
|
|
40
40
|
environment:
|
|
41
|
-
POSTGRES_PASSWORD: super-secret
|
|
41
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
|
|
42
42
|
mariadb113:
|
|
43
43
|
networks:
|
|
44
44
|
- default
|
|
45
45
|
image: mariadb:11.3
|
|
46
46
|
ports:
|
|
47
|
-
- "3359:3306" # use a non-standard port here
|
|
47
|
+
- "${MARIADB113_PORT:-3359}:3306" # use a non-standard port here
|
|
48
48
|
environment:
|
|
49
|
-
MARIADB_ROOT_PASSWORD: super-secret
|
|
50
|
-
MARIADB_PASSWORD: super-secret
|
|
51
|
-
MARIADB_USER: app
|
|
52
|
-
MARIADB_DATABASE: db
|
|
49
|
+
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD:-super-secret}
|
|
50
|
+
MARIADB_PASSWORD: ${MARIADB_PASSWORD:-super-secret}
|
|
51
|
+
MARIADB_USER: ${MARIADB_USER:-app}
|
|
52
|
+
MARIADB_DATABASE: ${MARIADB_DATABASE:-db}
|
|
53
53
|
MARIADB_ROOT_HOST: "%"
|
|
54
54
|
LANG: C.UTF-8
|
|
55
55
|
mysql8:
|
|
@@ -57,12 +57,12 @@ services:
|
|
|
57
57
|
- default
|
|
58
58
|
image: mysql:latest
|
|
59
59
|
ports:
|
|
60
|
-
- "3360:3306" # use a non-standard port here
|
|
60
|
+
- "${MYSQL8_PORT:-3360}:3306" # use a non-standard port here
|
|
61
61
|
environment:
|
|
62
|
-
MYSQL_ROOT_PASSWORD: super-secret
|
|
63
|
-
MYSQL_PASSWORD: super-secret
|
|
64
|
-
MYSQL_USER: app
|
|
65
|
-
MYSQL_DATABASE: db
|
|
62
|
+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-super-secret}
|
|
63
|
+
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-super-secret}
|
|
64
|
+
MYSQL_USER: ${MYSQL_USER:-app}
|
|
65
|
+
MYSQL_DATABASE: ${MYSQL_DATABASE:-db}
|
|
66
66
|
MYSQL_ROOT_HOST: "%"
|
|
67
67
|
LANG: C.UTF-8
|
|
68
68
|
mysql57:
|
|
@@ -70,12 +70,12 @@ services:
|
|
|
70
70
|
- default
|
|
71
71
|
image: mysql:5.7
|
|
72
72
|
ports:
|
|
73
|
-
- "3362:3306" # use a non-standard port here
|
|
73
|
+
- "${MYSQL57_PORT:-3362}:3306" # use a non-standard port here
|
|
74
74
|
environment:
|
|
75
|
-
MYSQL_ROOT_PASSWORD: super-secret
|
|
76
|
-
MYSQL_PASSWORD: super-secret
|
|
77
|
-
MYSQL_USER: app
|
|
78
|
-
MYSQL_DATABASE: db
|
|
75
|
+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-super-secret}
|
|
76
|
+
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-super-secret}
|
|
77
|
+
MYSQL_USER: ${MYSQL_USER:-app}
|
|
78
|
+
MYSQL_DATABASE: ${MYSQL_DATABASE:-db}
|
|
79
79
|
MYSQL_ROOT_HOST: "%"
|
|
80
80
|
LANG: C.UTF-8
|
|
81
81
|
mysql56:
|
|
@@ -83,12 +83,12 @@ services:
|
|
|
83
83
|
- default
|
|
84
84
|
image: mysql:5.6
|
|
85
85
|
ports:
|
|
86
|
-
- "3363:3306" # use a non-standard port here
|
|
86
|
+
- "${MYSQL56_PORT:-3363}:3306" # use a non-standard port here
|
|
87
87
|
environment:
|
|
88
|
-
MYSQL_ROOT_PASSWORD: super-secret
|
|
89
|
-
MYSQL_PASSWORD: super-secret
|
|
90
|
-
MYSQL_USER: app
|
|
91
|
-
MYSQL_DATABASE: db
|
|
88
|
+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-super-secret}
|
|
89
|
+
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-super-secret}
|
|
90
|
+
MYSQL_USER: ${MYSQL_USER:-app}
|
|
91
|
+
MYSQL_DATABASE: ${MYSQL_DATABASE:-db}
|
|
92
92
|
MYSQL_ROOT_HOST: "%"
|
|
93
93
|
LANG: C.UTF-8
|
|
94
94
|
oracle18c:
|
|
@@ -96,36 +96,36 @@ services:
|
|
|
96
96
|
- default
|
|
97
97
|
image: gvenzl/oracle-xe:18-slim-faststart
|
|
98
98
|
ports:
|
|
99
|
-
- "1514:1521" # use a non-standard port here
|
|
99
|
+
- "${ORACLE18C_PORT:-1514}:1521" # use a non-standard port here
|
|
100
100
|
environment:
|
|
101
|
-
ORACLE_PASSWORD: super-secret
|
|
102
|
-
APP_USER_PASSWORD: super-secret
|
|
103
|
-
APP_USER: app
|
|
101
|
+
ORACLE_PASSWORD: ${ORACLE_SYSTEM_PASSWORD:-super-secret}
|
|
102
|
+
APP_USER_PASSWORD: ${ORACLE_PASSWORD:-super-secret}
|
|
103
|
+
APP_USER: ${ORACLE_USER:-app}
|
|
104
104
|
oracle23c:
|
|
105
105
|
networks:
|
|
106
106
|
- default
|
|
107
107
|
image: gvenzl/oracle-free:23-slim-faststart
|
|
108
108
|
ports:
|
|
109
|
-
- "1513:1521" # use a non-standard port here
|
|
109
|
+
- "${ORACLE23C_PORT:-1513}:1521" # use a non-standard port here
|
|
110
110
|
environment:
|
|
111
|
-
ORACLE_PASSWORD: super-secret
|
|
112
|
-
APP_USER_PASSWORD: super-secret
|
|
113
|
-
APP_USER: app
|
|
111
|
+
ORACLE_PASSWORD: ${ORACLE_SYSTEM_PASSWORD:-super-secret}
|
|
112
|
+
APP_USER_PASSWORD: ${ORACLE_PASSWORD:-super-secret}
|
|
113
|
+
APP_USER: ${ORACLE_USER:-app}
|
|
114
114
|
mssql2022:
|
|
115
115
|
networks:
|
|
116
116
|
- default
|
|
117
117
|
image: mcr.microsoft.com/mssql/server:2022-latest
|
|
118
118
|
ports:
|
|
119
|
-
- "4133:1433" # use a non-standard port here
|
|
119
|
+
- "${MSSQL2022_PORT:-4133}:1433" # use a non-standard port here
|
|
120
120
|
environment:
|
|
121
|
-
SA_PASSWORD: Super-secret1
|
|
121
|
+
SA_PASSWORD: ${MSSQL_PASSWORD:-Super-secret1}
|
|
122
122
|
MSSQL_PID: Developer
|
|
123
123
|
ACCEPT_EULA: Accepted
|
|
124
124
|
MSSQL_TCP_PORT: 1433
|
|
125
125
|
spanner:
|
|
126
126
|
image: gcr.io/cloud-spanner-emulator/emulator:latest
|
|
127
127
|
ports:
|
|
128
|
-
- "9010:9010"
|
|
128
|
+
- "${SPANNER_PORT:-9010}:9010"
|
|
129
129
|
# Init (Create Instance)
|
|
130
130
|
spanner_init:
|
|
131
131
|
image: gcr.io/google.com/cloudsdktool/cloud-sdk:332.0.0-slim
|
|
@@ -136,9 +136,9 @@ services:
|
|
|
136
136
|
gcloud config set auth/disable_credentials true &&
|
|
137
137
|
gcloud spanner instances create $${INSTANCE_NAME} --config=emulator-config --description=Emulator --nodes=1'
|
|
138
138
|
environment:
|
|
139
|
-
PROJECT_ID: emulator-test-project
|
|
140
|
-
INSTANCE_NAME: test-instance
|
|
141
|
-
DATABASE_NAME: test-database
|
|
139
|
+
PROJECT_ID: ${GOOGLE_CLOUD_PROJECT:-emulator-test-project}
|
|
140
|
+
INSTANCE_NAME: ${SPANNER_INSTANCE:-test-instance}
|
|
141
|
+
DATABASE_NAME: ${SPANNER_DATABASE:-test-database}
|
|
142
142
|
depends_on:
|
|
143
143
|
- spanner
|
|
144
144
|
cockroachdb:
|
|
@@ -147,9 +147,9 @@ services:
|
|
|
147
147
|
restart: "no"
|
|
148
148
|
expose:
|
|
149
149
|
- "8080"
|
|
150
|
-
- "26257"
|
|
150
|
+
- "${COCKROACHDB_PORT:-26257}"
|
|
151
151
|
ports:
|
|
152
|
-
- "26257:26257"
|
|
152
|
+
- "${COCKROACHDB_PORT:-26257}:26257"
|
|
153
153
|
- "8880:8080"
|
|
154
154
|
healthcheck:
|
|
155
155
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"]
|
|
@@ -159,17 +159,17 @@ services:
|
|
|
159
159
|
redis:
|
|
160
160
|
image: redis
|
|
161
161
|
ports:
|
|
162
|
-
- "6397:6379"
|
|
162
|
+
- "${REDIS_PORT:-6397}:6379"
|
|
163
163
|
keydb:
|
|
164
164
|
image: eqalpha/keydb
|
|
165
165
|
ports:
|
|
166
|
-
- "6396:6379"
|
|
166
|
+
- "${KEYDB_PORT:-6396}:6379"
|
|
167
167
|
dragonfly:
|
|
168
168
|
image: "docker.dragonflydb.io/dragonflydb/dragonfly"
|
|
169
169
|
ulimits:
|
|
170
170
|
memlock: -1
|
|
171
171
|
ports:
|
|
172
|
-
- "6398:6379"
|
|
172
|
+
- "${DRAGONFLY_PORT:-6398}:6379"
|
|
173
173
|
# For better performance, consider `host` mode instead `port` to avoid docker NAT.
|
|
174
174
|
# `host` mode is NOT currently supported in Swarm Mode.
|
|
175
175
|
# https://docs.docker.com/compose/compose-file/compose-file-v3/#network_mode
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import os
|
|
26
27
|
from typing import TYPE_CHECKING
|
|
27
28
|
|
|
28
29
|
import pytest
|
|
@@ -50,4 +51,5 @@ def dragonfly_port() -> int:
|
|
|
50
51
|
|
|
51
52
|
@pytest.fixture(autouse=False)
|
|
52
53
|
async def dragonfly_service(docker_services: DockerServiceRegistry, dragonfly_port: int) -> None:
|
|
54
|
+
os.environ["DRAGONFLY_PORT"] = str(dragonfly_port)
|
|
53
55
|
await docker_services.start("dragonfly", check=dragonfly_responsive, port=dragonfly_port)
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import os
|
|
26
27
|
from typing import TYPE_CHECKING
|
|
27
28
|
|
|
28
29
|
import pytest
|
|
@@ -50,4 +51,5 @@ def keydb_port() -> int:
|
|
|
50
51
|
|
|
51
52
|
@pytest.fixture(autouse=False)
|
|
52
53
|
async def keydb_service(docker_services: DockerServiceRegistry, keydb_port: int) -> None:
|
|
54
|
+
os.environ["KEYDB_PORT"] = str(keydb_port)
|
|
53
55
|
await docker_services.start("keydb", check=keydb_responsive, port=keydb_port)
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import contextlib
|
|
27
|
+
import os
|
|
26
28
|
from typing import TYPE_CHECKING
|
|
27
29
|
|
|
28
30
|
import asyncmy
|
|
@@ -50,7 +52,8 @@ async def mariadb_responsive(host: str, port: int, user: str, password: str, dat
|
|
|
50
52
|
resp = await cursor.fetchone()
|
|
51
53
|
return resp[0] == 1
|
|
52
54
|
finally:
|
|
53
|
-
|
|
55
|
+
with contextlib.suppress(Exception):
|
|
56
|
+
await conn.close()
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
@pytest.fixture()
|
|
@@ -63,6 +66,11 @@ def mariadb_password() -> str:
|
|
|
63
66
|
return "super-secret"
|
|
64
67
|
|
|
65
68
|
|
|
69
|
+
@pytest.fixture()
|
|
70
|
+
def mariadb_root_password() -> str:
|
|
71
|
+
return "super-secret"
|
|
72
|
+
|
|
73
|
+
|
|
66
74
|
@pytest.fixture()
|
|
67
75
|
def mariadb_database() -> str:
|
|
68
76
|
return "db"
|
|
@@ -90,9 +98,15 @@ async def mariadb113_service(
|
|
|
90
98
|
mariadb_database: str,
|
|
91
99
|
mariadb_user: str,
|
|
92
100
|
mariadb_password: str,
|
|
101
|
+
mariadb_root_password: str,
|
|
93
102
|
) -> None:
|
|
103
|
+
os.environ["MARIADB_ROOT_PASSWORD"] = mariadb_root_password
|
|
104
|
+
os.environ["MARIADB_PASSWORD"] = mariadb_password
|
|
105
|
+
os.environ["MARIADB_USER"] = mariadb_user
|
|
106
|
+
os.environ["MARIADB_DATABASE"] = mariadb_database
|
|
107
|
+
os.environ["MARIADB113_PORT"] = str(mariadb113_port)
|
|
94
108
|
await docker_services.start(
|
|
95
|
-
"
|
|
109
|
+
"mariadb113",
|
|
96
110
|
timeout=45,
|
|
97
111
|
pause=1,
|
|
98
112
|
check=mariadb_responsive,
|
|
@@ -111,7 +125,13 @@ async def mariadb_service(
|
|
|
111
125
|
mariadb_database: str,
|
|
112
126
|
mariadb_user: str,
|
|
113
127
|
mariadb_password: str,
|
|
128
|
+
mariadb_root_password: str,
|
|
114
129
|
) -> None:
|
|
130
|
+
os.environ["MARIADB_ROOT_PASSWORD"] = mariadb_root_password
|
|
131
|
+
os.environ["MARIADB_PASSWORD"] = mariadb_password
|
|
132
|
+
os.environ["MARIADB_USER"] = mariadb_user
|
|
133
|
+
os.environ["MARIADB_DATABASE"] = mariadb_database
|
|
134
|
+
os.environ[f"{mariadb_default_version.upper()}_PORT"] = str(mariadb_port)
|
|
115
135
|
await docker_services.start(
|
|
116
136
|
mariadb_default_version,
|
|
117
137
|
timeout=45,
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
26
|
import asyncio
|
|
27
|
+
import os
|
|
27
28
|
from typing import TYPE_CHECKING
|
|
28
29
|
|
|
29
30
|
import aioodbc
|
|
@@ -33,16 +34,16 @@ if TYPE_CHECKING:
|
|
|
33
34
|
from pytest_databases.docker import DockerServiceRegistry
|
|
34
35
|
|
|
35
36
|
|
|
36
|
-
async def mssql_responsive(host: str,
|
|
37
|
+
async def mssql_responsive(host: str, connstring: str) -> bool:
|
|
37
38
|
await asyncio.sleep(1)
|
|
38
39
|
try:
|
|
39
40
|
conn = await aioodbc.connect(
|
|
40
|
-
connstring
|
|
41
|
+
dsn=connstring,
|
|
41
42
|
timeout=2,
|
|
42
43
|
)
|
|
43
44
|
async with conn.cursor() as cursor:
|
|
44
45
|
await cursor.execute("select 1 as is_available")
|
|
45
|
-
resp = cursor.fetchone()
|
|
46
|
+
resp = await cursor.fetchone()
|
|
46
47
|
return resp[0] == 1 if resp is not None else False
|
|
47
48
|
except Exception: # noqa: BLE001
|
|
48
49
|
return False
|
|
@@ -55,7 +56,7 @@ def mssql_user() -> str:
|
|
|
55
56
|
|
|
56
57
|
@pytest.fixture()
|
|
57
58
|
def mssql_password() -> str:
|
|
58
|
-
return "
|
|
59
|
+
return "Super-secret1"
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
@pytest.fixture()
|
|
@@ -74,46 +75,52 @@ def mssql_default_version() -> str:
|
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
@pytest.fixture()
|
|
77
|
-
def mssql_port(
|
|
78
|
-
return
|
|
78
|
+
def mssql_port(mssql2022_port: int) -> int:
|
|
79
|
+
return mssql2022_port
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
@pytest.fixture(autouse=False)
|
|
82
83
|
async def mssql2022_service(
|
|
83
84
|
docker_services: DockerServiceRegistry,
|
|
85
|
+
docker_ip: str,
|
|
84
86
|
mssql2022_port: int,
|
|
85
87
|
mssql_database: str,
|
|
86
88
|
mssql_user: str,
|
|
87
89
|
mssql_password: str,
|
|
88
90
|
) -> None:
|
|
91
|
+
os.environ["MSSQL_PASSWORD"] = mssql_password
|
|
92
|
+
os.environ["MSSQL_USER"] = mssql_user
|
|
93
|
+
os.environ["MSSQL_DATABASE"] = mssql_database
|
|
94
|
+
os.environ["MSSQL2022_PORT"] = str(mssql2022_port)
|
|
95
|
+
connstring = f"encrypt=no; TrustServerCertificate=yes; driver={{ODBC Driver 18 for SQL Server}}; server={docker_ip},{mssql2022_port}; database={mssql_database}; UID={mssql_user}; PWD={mssql_password}"
|
|
89
96
|
await docker_services.start(
|
|
90
97
|
"mssql2022",
|
|
91
98
|
timeout=120,
|
|
92
99
|
pause=1,
|
|
93
100
|
check=mssql_responsive,
|
|
94
|
-
|
|
95
|
-
database=mssql_database,
|
|
96
|
-
user=mssql_user,
|
|
97
|
-
password=mssql_password,
|
|
101
|
+
connstring=connstring,
|
|
98
102
|
)
|
|
99
103
|
|
|
100
104
|
|
|
101
105
|
@pytest.fixture(autouse=False)
|
|
102
106
|
async def mssql_service(
|
|
103
107
|
docker_services: DockerServiceRegistry,
|
|
108
|
+
docker_ip: str,
|
|
104
109
|
mssql_default_version: str,
|
|
105
110
|
mssql_port: int,
|
|
106
111
|
mssql_database: str,
|
|
107
112
|
mssql_user: str,
|
|
108
113
|
mssql_password: str,
|
|
109
114
|
) -> None:
|
|
115
|
+
connstring = f"encrypt=no; TrustServerCertificate=yes; driver={{ODBC Driver 18 for SQL Server}}; server={docker_ip},{mssql_port}; database={mssql_database}; UID={mssql_user}; PWD={mssql_password}"
|
|
116
|
+
os.environ["MSSQL_PASSWORD"] = mssql_password
|
|
117
|
+
os.environ["MSSQL_USER"] = mssql_user
|
|
118
|
+
os.environ["MSSQL_DATABASE"] = mssql_database
|
|
119
|
+
os.environ[f"{mssql_default_version.upper()}_PORT"] = str(mssql_port)
|
|
110
120
|
await docker_services.start(
|
|
111
121
|
mssql_default_version,
|
|
112
122
|
timeout=120,
|
|
113
123
|
pause=1,
|
|
114
124
|
check=mssql_responsive,
|
|
115
|
-
|
|
116
|
-
database=mssql_database,
|
|
117
|
-
user=mssql_user,
|
|
118
|
-
password=mssql_password,
|
|
125
|
+
connstring=connstring,
|
|
119
126
|
)
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import contextlib
|
|
27
|
+
import os
|
|
26
28
|
from typing import TYPE_CHECKING
|
|
27
29
|
|
|
28
30
|
import asyncmy
|
|
@@ -50,7 +52,8 @@ async def mysql_responsive(host: str, port: int, user: str, password: str, datab
|
|
|
50
52
|
resp = await cursor.fetchone()
|
|
51
53
|
return resp[0] == 1
|
|
52
54
|
finally:
|
|
53
|
-
|
|
55
|
+
with contextlib.suppress(Exception):
|
|
56
|
+
await conn.close()
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
@pytest.fixture()
|
|
@@ -63,6 +66,11 @@ def mysql_password() -> str:
|
|
|
63
66
|
return "super-secret"
|
|
64
67
|
|
|
65
68
|
|
|
69
|
+
@pytest.fixture()
|
|
70
|
+
def mysql_root_password() -> str:
|
|
71
|
+
return "super-secret"
|
|
72
|
+
|
|
73
|
+
|
|
66
74
|
@pytest.fixture()
|
|
67
75
|
def mysql_database() -> str:
|
|
68
76
|
return "db"
|
|
@@ -95,8 +103,18 @@ def mysql_port(mysql8_port: int) -> int:
|
|
|
95
103
|
|
|
96
104
|
@pytest.fixture(autouse=False)
|
|
97
105
|
async def mysql8_service(
|
|
98
|
-
docker_services: DockerServiceRegistry,
|
|
106
|
+
docker_services: DockerServiceRegistry,
|
|
107
|
+
mysql8_port: int,
|
|
108
|
+
mysql_database: str,
|
|
109
|
+
mysql_user: str,
|
|
110
|
+
mysql_password: str,
|
|
111
|
+
mysql_root_password: str,
|
|
99
112
|
) -> None:
|
|
113
|
+
os.environ["MYSQL_ROOT_PASSWORD"] = mysql_root_password
|
|
114
|
+
os.environ["MYSQL_PASSWORD"] = mysql_password
|
|
115
|
+
os.environ["MYSQL_USER"] = mysql_user
|
|
116
|
+
os.environ["MYSQL_DATABASE"] = mysql_database
|
|
117
|
+
os.environ["MYSQL8_PORT"] = str(mysql8_port)
|
|
100
118
|
await docker_services.start(
|
|
101
119
|
"mysql8",
|
|
102
120
|
timeout=45,
|
|
@@ -111,8 +129,18 @@ async def mysql8_service(
|
|
|
111
129
|
|
|
112
130
|
@pytest.fixture(autouse=False)
|
|
113
131
|
async def mysql57_service(
|
|
114
|
-
docker_services: DockerServiceRegistry,
|
|
132
|
+
docker_services: DockerServiceRegistry,
|
|
133
|
+
mysql57_port: int,
|
|
134
|
+
mysql_database: str,
|
|
135
|
+
mysql_user: str,
|
|
136
|
+
mysql_password: str,
|
|
137
|
+
mysql_root_password: str,
|
|
115
138
|
) -> None:
|
|
139
|
+
os.environ["MYSQL_ROOT_PASSWORD"] = mysql_root_password
|
|
140
|
+
os.environ["MYSQL_PASSWORD"] = mysql_password
|
|
141
|
+
os.environ["MYSQL_USER"] = mysql_user
|
|
142
|
+
os.environ["MYSQL_DATABASE"] = mysql_database
|
|
143
|
+
os.environ["MYSQL57_PORT"] = str(mysql57_port)
|
|
116
144
|
await docker_services.start(
|
|
117
145
|
"mysql57",
|
|
118
146
|
timeout=45,
|
|
@@ -127,8 +155,18 @@ async def mysql57_service(
|
|
|
127
155
|
|
|
128
156
|
@pytest.fixture(autouse=False)
|
|
129
157
|
async def mysql56_service(
|
|
130
|
-
docker_services: DockerServiceRegistry,
|
|
158
|
+
docker_services: DockerServiceRegistry,
|
|
159
|
+
mysql56_port: int,
|
|
160
|
+
mysql_database: str,
|
|
161
|
+
mysql_user: str,
|
|
162
|
+
mysql_password: str,
|
|
163
|
+
mysql_root_password: str,
|
|
131
164
|
) -> None:
|
|
165
|
+
os.environ["MYSQL_ROOT_PASSWORD"] = mysql_root_password
|
|
166
|
+
os.environ["MYSQL_PASSWORD"] = mysql_password
|
|
167
|
+
os.environ["MYSQL_USER"] = mysql_user
|
|
168
|
+
os.environ["MYSQL_DATABASE"] = mysql_database
|
|
169
|
+
os.environ["MYSQL56_PORT"] = str(mysql56_port)
|
|
132
170
|
await docker_services.start(
|
|
133
171
|
"mysql56",
|
|
134
172
|
timeout=45,
|
|
@@ -149,7 +187,13 @@ async def mysql_service(
|
|
|
149
187
|
mysql_database: str,
|
|
150
188
|
mysql_user: str,
|
|
151
189
|
mysql_password: str,
|
|
190
|
+
mysql_root_password: str,
|
|
152
191
|
) -> None:
|
|
192
|
+
os.environ["MYSQL_ROOT_PASSWORD"] = mysql_root_password
|
|
193
|
+
os.environ["MYSQL_PASSWORD"] = mysql_password
|
|
194
|
+
os.environ["MYSQL_USER"] = mysql_user
|
|
195
|
+
os.environ["MYSQL_DATABASE"] = mysql_database
|
|
196
|
+
os.environ[f"{mysql_default_version.upper()}_PORT"] = str(mysql_port)
|
|
153
197
|
await docker_services.start(
|
|
154
198
|
mysql_default_version,
|
|
155
199
|
timeout=45,
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
from __future__ import annotations
|
|
25
25
|
|
|
26
|
+
import os
|
|
26
27
|
from typing import TYPE_CHECKING
|
|
27
28
|
|
|
28
29
|
import oracledb
|
|
@@ -59,6 +60,11 @@ def oracle_password() -> str:
|
|
|
59
60
|
return "super-secret"
|
|
60
61
|
|
|
61
62
|
|
|
63
|
+
@pytest.fixture()
|
|
64
|
+
def oracle_system_password() -> str:
|
|
65
|
+
return "super-secret"
|
|
66
|
+
|
|
67
|
+
|
|
62
68
|
@pytest.fixture()
|
|
63
69
|
def oracle18c_service_name() -> str:
|
|
64
70
|
return "xepdb1"
|
|
@@ -99,9 +105,15 @@ async def oracle23c_service(
|
|
|
99
105
|
docker_services: DockerServiceRegistry,
|
|
100
106
|
oracle23c_port: int,
|
|
101
107
|
oracle23c_service_name: str,
|
|
108
|
+
oracle_system_password: str,
|
|
102
109
|
oracle_user: str,
|
|
103
110
|
oracle_password: str,
|
|
104
111
|
) -> None:
|
|
112
|
+
os.environ["ORACLE_PASSWORD"] = oracle_password
|
|
113
|
+
os.environ["ORACLE_SYSTEM_PASSWORD"] = oracle_system_password
|
|
114
|
+
os.environ["ORACLE_USER"] = oracle_user
|
|
115
|
+
os.environ["ORACLE23C_SERVICE_NAME"] = oracle23c_service_name
|
|
116
|
+
os.environ["ORACLE23C_PORT"] = str(oracle23c_port)
|
|
105
117
|
await docker_services.start(
|
|
106
118
|
"oracle23c",
|
|
107
119
|
timeout=90,
|
|
@@ -119,9 +131,15 @@ async def oracle18c_service(
|
|
|
119
131
|
docker_services: DockerServiceRegistry,
|
|
120
132
|
oracle18c_port: int,
|
|
121
133
|
oracle18c_service_name: str,
|
|
134
|
+
oracle_system_password: str,
|
|
122
135
|
oracle_user: str,
|
|
123
136
|
oracle_password: str,
|
|
124
137
|
) -> None:
|
|
138
|
+
os.environ["ORACLE_PASSWORD"] = oracle_password
|
|
139
|
+
os.environ["ORACLE_SYSTEM_PASSWORD"] = oracle_system_password
|
|
140
|
+
os.environ["ORACLE_USER"] = oracle_user
|
|
141
|
+
os.environ["ORACLE18C_SERVICE_NAME"] = oracle18c_service_name
|
|
142
|
+
os.environ["ORACLE18C_PORT"] = str(oracle18c_port)
|
|
125
143
|
await docker_services.start(
|
|
126
144
|
"oracle18c",
|
|
127
145
|
timeout=90,
|
|
@@ -141,9 +159,15 @@ async def oracle_service(
|
|
|
141
159
|
oracle_default_version: str,
|
|
142
160
|
oracle_port: int,
|
|
143
161
|
oracle_service_name: str,
|
|
162
|
+
oracle_system_password: str,
|
|
144
163
|
oracle_user: str,
|
|
145
164
|
oracle_password: str,
|
|
146
165
|
) -> None:
|
|
166
|
+
os.environ["ORACLE_PASSWORD"] = oracle_password
|
|
167
|
+
os.environ["ORACLE_SYSTEM_PASSWORD"] = oracle_system_password
|
|
168
|
+
os.environ["ORACLE_USER"] = oracle_user
|
|
169
|
+
os.environ["ORACLE_SERVICE_NAME"] = oracle_service_name
|
|
170
|
+
os.environ[f"{oracle_default_version.upper()}_PORT"] = str(oracle_port)
|
|
147
171
|
await docker_services.start(
|
|
148
172
|
oracle_default_version,
|
|
149
173
|
timeout=90,
|