pytest-databases 0.11.0__tar.gz → 0.12.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.11.0 → pytest_databases-0.12.0}/.github/workflows/ci.yaml +1 -1
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.pre-commit-config.yaml +1 -1
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.vscode/settings.json +2 -1
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/Makefile +1 -1
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/PKG-INFO +13 -11
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/README.md +8 -8
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/pyproject.toml +11 -10
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/scripts/build_docs.py +4 -1
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/_service.py +14 -2
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/__init__.py +3 -3
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/azure_blob.py +3 -1
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/mariadb.py +2 -1
- pytest_databases-0.12.0/src/pytest_databases/docker/minio.py +120 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/redis.py +3 -1
- pytest_databases-0.12.0/tests/test_minio.py +89 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/uv.lock +775 -946
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.github/CODEOWNERS +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.github/dependabot.yaml +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.github/workflows/cd.yaml +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.github/workflows/pr-title.yaml +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.github/workflows/release.yaml +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.gitignore +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.sourcery.yaml +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/.vscode/launch.json +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/CODEOWNERS +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/CONTRIBUTING.rst +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/LICENSE +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/scripts/__init__.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/scripts/convert_docs.sh +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/scripts/install-hatch.sh +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/sonar-project.properties +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/__init__.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/__metadata__.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/alloydb_omni.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/bigquery.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/cockroachdb.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/elastic_search.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/mssql.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/mysql.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/oracle.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/postgres.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/spanner.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/helpers.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/py.typed +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/types.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/__init__.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/conftest.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_alloydb_omni.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_azure_blob.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_bigquery.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_cockroachdb.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_elasticsearch.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_mariadb.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_mssql.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_mysql.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_oracle.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_postgres.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_redis.py +0 -0
- {pytest_databases-0.11.0 → pytest_databases-0.12.0}/tests/test_spanner.py +0 -0
|
@@ -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.11.2" # make sure this is always consistent with hatch configs
|
|
23
23
|
hooks:
|
|
24
24
|
- id: ruff
|
|
25
25
|
args: [--config, ./pyproject.toml]
|
|
@@ -88,5 +88,6 @@
|
|
|
88
88
|
"tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
|
|
89
89
|
"tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
|
|
90
90
|
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
|
|
91
|
-
]
|
|
91
|
+
],
|
|
92
|
+
"python.analysis.extraPaths": ["${workspaceFolder}/src"]
|
|
92
93
|
}
|
|
@@ -167,7 +167,7 @@ pre-commit: ## Run pre-commit hooks
|
|
|
167
167
|
.PHONY: slotscheck
|
|
168
168
|
slotscheck: ## Run slotscheck
|
|
169
169
|
@echo "${INFO} Running slots check... 🔍"
|
|
170
|
-
@uv run slotscheck
|
|
170
|
+
@uv run slotscheck src/pytest_databases
|
|
171
171
|
@echo "${OK} Slots check passed ✨"
|
|
172
172
|
|
|
173
173
|
.PHONY: fix
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-databases
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.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
|
|
7
7
|
Project-URL: Source, https://github.com/litestar-org/pytest-databases
|
|
8
|
-
Author-email: Cody Fincher <cody
|
|
8
|
+
Author-email: Cody Fincher <cody@litestar.dev>
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Keywords: alloydb,alloydbomni,azure,bigquery,cockroachdb,database,duckdb,elasticsearch,migration,mssql,mysql,oracle,postgres,redis,spanner
|
|
@@ -38,8 +38,10 @@ Provides-Extra: keydb
|
|
|
38
38
|
Requires-Dist: redis; extra == 'keydb'
|
|
39
39
|
Provides-Extra: mariadb
|
|
40
40
|
Requires-Dist: mariadb; extra == 'mariadb'
|
|
41
|
+
Provides-Extra: minio
|
|
42
|
+
Requires-Dist: minio; extra == 'minio'
|
|
41
43
|
Provides-Extra: mssql
|
|
42
|
-
Requires-Dist: pymssql
|
|
44
|
+
Requires-Dist: pymssql; extra == 'mssql'
|
|
43
45
|
Provides-Extra: mysql
|
|
44
46
|
Requires-Dist: mysql-connector-python; extra == 'mysql'
|
|
45
47
|
Provides-Extra: oracle
|
|
@@ -56,11 +58,11 @@ Description-Content-Type: text/markdown
|
|
|
56
58
|
|
|
57
59
|
Reusable test fixtures for any and all databases.
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
<!-- markdownlint-disable no-inline-html -->
|
|
61
62
|
<!-- prettier-ignore-start -->
|
|
63
|
+
<p align="center">
|
|
62
64
|
|
|
63
|
-
| Project | | Status
|
|
65
|
+
| Project | | Status |
|
|
64
66
|
|-----------|:----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
65
67
|
| CI/CD | | [](https://github.com/litestar-org/pytest-databases/actions/workflows/release.yaml) [](https://github.com/litestar-org/pytest-databases/actions/workflows/ci.yaml) [](https://github.com/litestar-org/pytest-databases/actions/workflows/docs.yaml) |
|
|
66
68
|
| Quality | | [](https://codecov.io/github/litestar-org/pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) |
|
|
@@ -68,8 +70,9 @@ Reusable test fixtures for any and all databases.
|
|
|
68
70
|
| Community | | [](https://discord.gg/litestar-919193495116337154) [](https://matrix.to/#/#litestar:matrix.org) [](https://blog.litestar.dev) [](https://twitter.com/LitestarAPI) [](https://blog.litestar.dev) |
|
|
69
71
|
| Meta | | [](https://github.com/litestar-org/pytest-databases) [](https://github.com/python/mypy) [](https://spdx.org/licenses/) [](https://github.com/sponsors/litestar-org) [](https://github.com/astral-sh/ruff) [](https://github.com/psf/black)|
|
|
70
72
|
|
|
73
|
+
</p>
|
|
74
|
+
|
|
71
75
|
<!-- prettier-ignore-end -->
|
|
72
|
-
</div>
|
|
73
76
|
|
|
74
77
|
> [!WARNING]
|
|
75
78
|
>
|
|
@@ -84,7 +87,7 @@ It is designed to offer pre-configured testing setups for many different types a
|
|
|
84
87
|
|
|
85
88
|
## Features
|
|
86
89
|
|
|
87
|
-
`pytest-databases`
|
|
90
|
+
`pytest-databases` uses the Docker Python SDK to manage the startup and shutdown of database services in containers. The following databases are currently available:
|
|
88
91
|
|
|
89
92
|
- **Postgres**: Version 12, 13, 14, 15, 16 and 17 are available
|
|
90
93
|
- **MySQL**: Version 5.6, 5.7 and 8 are available
|
|
@@ -100,6 +103,7 @@ It is designed to offer pre-configured testing setups for many different types a
|
|
|
100
103
|
- **KeyDB**: Latest version
|
|
101
104
|
- **Elasticsearch**: Version 7 and 8 are available
|
|
102
105
|
- **Azure blob storage**: Via azurite
|
|
106
|
+
- **Minio**: Latest version
|
|
103
107
|
|
|
104
108
|
## Contributing
|
|
105
109
|
|
|
@@ -110,9 +114,8 @@ Before contributing, please review the [contribution guide][contributing].
|
|
|
110
114
|
If you have any questions, reach out to us on [Discord][discord], our org-wide [GitHub discussions][litestar-discussions] page,
|
|
111
115
|
or the [project-specific GitHub discussions page][project-discussions].
|
|
112
116
|
|
|
113
|
-
<hr>
|
|
114
|
-
|
|
115
117
|
<!-- markdownlint-disable -->
|
|
118
|
+
<hr>
|
|
116
119
|
<p align="center">
|
|
117
120
|
<!-- github-banner-start -->
|
|
118
121
|
<img src="https://raw.githubusercontent.com/litestar-org/meta/2901c9c5c5895a83fbfa56944c33bca287f88d42/branding/SVG%20-%20Transparent/logo-full-wide.svg" alt="Litestar Logo - Light" width="20%" height="auto" />
|
|
@@ -127,4 +130,3 @@ or the [project-specific GitHub discussions page][project-discussions].
|
|
|
127
130
|
[project-discussions]: https://github.com/litestar-org/pytest-databases/discussions
|
|
128
131
|
[project-docs]: https://docs.pytest-databases.litestar.dev
|
|
129
132
|
[install-guide]: https://docs.pytest-databases.litestar.dev/latest/#installation
|
|
130
|
-
[newrepo]: https://github.com/organizations/litestar-org/repositories/new?template=pytest-databases
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Reusable test fixtures for any and all databases.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
<!-- markdownlint-disable no-inline-html -->
|
|
7
6
|
<!-- prettier-ignore-start -->
|
|
7
|
+
<p align="center">
|
|
8
8
|
|
|
9
|
-
| Project | | Status
|
|
9
|
+
| Project | | Status |
|
|
10
10
|
|-----------|:----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
11
11
|
| CI/CD | | [](https://github.com/litestar-org/pytest-databases/actions/workflows/release.yaml) [](https://github.com/litestar-org/pytest-databases/actions/workflows/ci.yaml) [](https://github.com/litestar-org/pytest-databases/actions/workflows/docs.yaml) |
|
|
12
12
|
| Quality | | [](https://codecov.io/github/litestar-org/pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) |
|
|
@@ -14,8 +14,9 @@ Reusable test fixtures for any and all databases.
|
|
|
14
14
|
| Community | | [](https://discord.gg/litestar-919193495116337154) [](https://matrix.to/#/#litestar:matrix.org) [](https://blog.litestar.dev) [](https://twitter.com/LitestarAPI) [](https://blog.litestar.dev) |
|
|
15
15
|
| Meta | | [](https://github.com/litestar-org/pytest-databases) [](https://github.com/python/mypy) [](https://spdx.org/licenses/) [](https://github.com/sponsors/litestar-org) [](https://github.com/astral-sh/ruff) [](https://github.com/psf/black)|
|
|
16
16
|
|
|
17
|
+
</p>
|
|
18
|
+
|
|
17
19
|
<!-- prettier-ignore-end -->
|
|
18
|
-
</div>
|
|
19
20
|
|
|
20
21
|
> [!WARNING]
|
|
21
22
|
>
|
|
@@ -30,7 +31,7 @@ It is designed to offer pre-configured testing setups for many different types a
|
|
|
30
31
|
|
|
31
32
|
## Features
|
|
32
33
|
|
|
33
|
-
`pytest-databases`
|
|
34
|
+
`pytest-databases` uses the Docker Python SDK to manage the startup and shutdown of database services in containers. The following databases are currently available:
|
|
34
35
|
|
|
35
36
|
- **Postgres**: Version 12, 13, 14, 15, 16 and 17 are available
|
|
36
37
|
- **MySQL**: Version 5.6, 5.7 and 8 are available
|
|
@@ -46,6 +47,7 @@ It is designed to offer pre-configured testing setups for many different types a
|
|
|
46
47
|
- **KeyDB**: Latest version
|
|
47
48
|
- **Elasticsearch**: Version 7 and 8 are available
|
|
48
49
|
- **Azure blob storage**: Via azurite
|
|
50
|
+
- **Minio**: Latest version
|
|
49
51
|
|
|
50
52
|
## Contributing
|
|
51
53
|
|
|
@@ -56,9 +58,8 @@ Before contributing, please review the [contribution guide][contributing].
|
|
|
56
58
|
If you have any questions, reach out to us on [Discord][discord], our org-wide [GitHub discussions][litestar-discussions] page,
|
|
57
59
|
or the [project-specific GitHub discussions page][project-discussions].
|
|
58
60
|
|
|
59
|
-
<hr>
|
|
60
|
-
|
|
61
61
|
<!-- markdownlint-disable -->
|
|
62
|
+
<hr>
|
|
62
63
|
<p align="center">
|
|
63
64
|
<!-- github-banner-start -->
|
|
64
65
|
<img src="https://raw.githubusercontent.com/litestar-org/meta/2901c9c5c5895a83fbfa56944c33bca287f88d42/branding/SVG%20-%20Transparent/logo-full-wide.svg" alt="Litestar Logo - Light" width="20%" height="auto" />
|
|
@@ -73,4 +74,3 @@ or the [project-specific GitHub discussions page][project-discussions].
|
|
|
73
74
|
[project-discussions]: https://github.com/litestar-org/pytest-databases/discussions
|
|
74
75
|
[project-docs]: https://docs.pytest-databases.litestar.dev
|
|
75
76
|
[install-guide]: https://docs.pytest-databases.litestar.dev/latest/#installation
|
|
76
|
-
[newrepo]: https://github.com/organizations/litestar-org/repositories/new?template=pytest-databases
|
|
@@ -12,9 +12,9 @@ license = "MIT"
|
|
|
12
12
|
name = "pytest-databases"
|
|
13
13
|
readme = "README.md"
|
|
14
14
|
requires-python = ">=3.9"
|
|
15
|
-
version = "0.
|
|
15
|
+
version = "0.12.0"
|
|
16
16
|
#
|
|
17
|
-
authors = [{ name = "Cody Fincher", email = "cody
|
|
17
|
+
authors = [{ name = "Cody Fincher", email = "cody@litestar.dev" }]
|
|
18
18
|
keywords = [
|
|
19
19
|
"database",
|
|
20
20
|
"migration",
|
|
@@ -61,27 +61,28 @@ elasticsearch7 = ["elasticsearch7"]
|
|
|
61
61
|
elasticsearch8 = ["elasticsearch8"]
|
|
62
62
|
keydb = ["redis"]
|
|
63
63
|
mariadb = ["mariadb"]
|
|
64
|
-
|
|
64
|
+
minio = ["minio"]
|
|
65
|
+
mssql = ["pymssql"]
|
|
65
66
|
mysql = ["mysql-connector-python"]
|
|
66
67
|
oracle = ["oracledb"]
|
|
67
68
|
postgres = ["psycopg>=3"]
|
|
68
69
|
redis = ["redis"]
|
|
69
70
|
spanner = ["google-cloud-spanner"]
|
|
70
71
|
|
|
71
|
-
|
|
72
72
|
[dependency-groups]
|
|
73
73
|
dev = [
|
|
74
74
|
# tests
|
|
75
75
|
"bump-my-version",
|
|
76
|
-
"pytest-databases[azure-storage,bigquery,cockroachdb,dragonfly,elasticsearch7,elasticsearch8,keydb,mssql,mysql,mariadb,oracle,postgres,redis,spanner]",
|
|
77
|
-
"coverage[toml]>=6.2",
|
|
76
|
+
"pytest-databases[azure-storage,bigquery,cockroachdb,dragonfly,elasticsearch7,elasticsearch8,keydb,mssql,mysql,mariadb,oracle,postgres,redis,spanner,minio]",
|
|
78
77
|
"coverage[toml]>=6.2",
|
|
79
78
|
"pytest",
|
|
80
79
|
"pytest-cov",
|
|
80
|
+
"pytest-cdist>=0.2",
|
|
81
81
|
"pytest-mock",
|
|
82
|
-
"pytest-vcr",
|
|
83
82
|
"pytest-click",
|
|
84
83
|
"pytest-xdist",
|
|
84
|
+
"pytest-sugar",
|
|
85
|
+
"slotscheck",
|
|
85
86
|
# lint
|
|
86
87
|
"mypy",
|
|
87
88
|
"ruff",
|
|
@@ -104,7 +105,7 @@ dev = [
|
|
|
104
105
|
"sphinx-design>=0.5.0",
|
|
105
106
|
"sphinxcontrib-mermaid>=0.9.2",
|
|
106
107
|
"auto-pytabs[sphinx]>=0.4.0",
|
|
107
|
-
|
|
108
|
+
|
|
108
109
|
]
|
|
109
110
|
|
|
110
111
|
|
|
@@ -116,7 +117,7 @@ dev = [
|
|
|
116
117
|
allow_dirty = true
|
|
117
118
|
commit = true
|
|
118
119
|
commit_args = "--no-verify"
|
|
119
|
-
current_version = "0.
|
|
120
|
+
current_version = "0.12.0"
|
|
120
121
|
ignore_missing_files = false
|
|
121
122
|
ignore_missing_version = false
|
|
122
123
|
message = "chore(release): bump to v{new_version}"
|
|
@@ -295,7 +296,7 @@ lint.select = ["ALL"]
|
|
|
295
296
|
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
296
297
|
preview = true # preview features & checks, use with caution
|
|
297
298
|
src = ["src", "tests/", "docs/"]
|
|
298
|
-
target-version = "
|
|
299
|
+
target-version = "py39"
|
|
299
300
|
|
|
300
301
|
[tool.ruff.lint.pydocstyle]
|
|
301
302
|
convention = "google"
|
|
@@ -5,7 +5,10 @@ import shutil
|
|
|
5
5
|
import subprocess # noqa: S404
|
|
6
6
|
from contextlib import contextmanager
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from collections.abc import Generator
|
|
9
12
|
|
|
10
13
|
REDIRECT_TEMPLATE = """
|
|
11
14
|
<!DOCTYPE HTML>
|
|
@@ -6,7 +6,7 @@ import os
|
|
|
6
6
|
import subprocess # noqa: S404
|
|
7
7
|
import time
|
|
8
8
|
from contextlib import AbstractContextManager, contextmanager
|
|
9
|
-
from typing import TYPE_CHECKING, Any, Callable
|
|
9
|
+
from typing import TYPE_CHECKING, Any, Callable
|
|
10
10
|
|
|
11
11
|
import filelock
|
|
12
12
|
import pytest
|
|
@@ -19,6 +19,7 @@ from pytest_databases.types import ServiceContainer
|
|
|
19
19
|
|
|
20
20
|
if TYPE_CHECKING:
|
|
21
21
|
import pathlib
|
|
22
|
+
from collections.abc import Generator
|
|
22
23
|
from types import TracebackType
|
|
23
24
|
|
|
24
25
|
from docker.models.containers import Container
|
|
@@ -164,7 +165,18 @@ class DockerService(AbstractContextManager):
|
|
|
164
165
|
ulimits=ulimits,
|
|
165
166
|
mem_limit=mem_limit,
|
|
166
167
|
)
|
|
167
|
-
|
|
168
|
+
|
|
169
|
+
# reload the container; sometimes it can take a while before docker
|
|
170
|
+
# spins it up and the metadata becomes available, so we're redoing the
|
|
171
|
+
# check with a small incremental backup here
|
|
172
|
+
for i in range(10):
|
|
173
|
+
if any(v for v in container.ports.values()):
|
|
174
|
+
break
|
|
175
|
+
container.reload()
|
|
176
|
+
time.sleep(0.1 + (i / 10))
|
|
177
|
+
else:
|
|
178
|
+
msg = f"Service {name!r} failed to create container"
|
|
179
|
+
raise ValueError(msg)
|
|
168
180
|
|
|
169
181
|
host_port = int(
|
|
170
182
|
container.ports[next(k for k in container.ports if k.startswith(str(container_port)))][0]["HostPort"]
|
|
@@ -6,16 +6,16 @@ import subprocess # noqa: S404
|
|
|
6
6
|
import time
|
|
7
7
|
import timeit
|
|
8
8
|
from contextlib import AbstractContextManager
|
|
9
|
-
from typing import TYPE_CHECKING, Any, Callable
|
|
9
|
+
from typing import TYPE_CHECKING, Any, Callable
|
|
10
10
|
|
|
11
11
|
from pytest_databases.helpers import simple_string_hash
|
|
12
12
|
|
|
13
13
|
if TYPE_CHECKING:
|
|
14
|
-
from collections.abc import Awaitable, Generator
|
|
14
|
+
from collections.abc import Awaitable, Generator, Iterable
|
|
15
15
|
from pathlib import Path
|
|
16
16
|
from types import TracebackType
|
|
17
17
|
|
|
18
|
-
TRUE_VALUES = {"True", "true", "1", "yes", "Y", "T"}
|
|
18
|
+
TRUE_VALUES = {"True", "true", "1", "yes", "y", "Y", "T", "on", "enabled", "ok"}
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def wait_until_responsive(
|
{pytest_databases-0.11.0 → pytest_databases-0.12.0}/src/pytest_databases/docker/azure_blob.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from typing import TYPE_CHECKING
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
7
|
from azure.storage.blob import ContainerClient
|
|
@@ -11,6 +11,8 @@ from pytest_databases.helpers import get_xdist_worker_count, get_xdist_worker_nu
|
|
|
11
11
|
from pytest_databases.types import ServiceContainer, XdistIsolationLevel
|
|
12
12
|
|
|
13
13
|
if TYPE_CHECKING:
|
|
14
|
+
from collections.abc import AsyncGenerator, Generator
|
|
15
|
+
|
|
14
16
|
from pytest_databases._service import DockerService
|
|
15
17
|
|
|
16
18
|
|
|
@@ -2,8 +2,9 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import contextlib
|
|
4
4
|
import traceback
|
|
5
|
+
from collections.abc import Generator
|
|
5
6
|
from dataclasses import dataclass
|
|
6
|
-
from typing import TYPE_CHECKING
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
7
8
|
|
|
8
9
|
import mariadb
|
|
9
10
|
import pytest
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
from urllib.error import URLError
|
|
5
|
+
from urllib.request import Request, urlopen
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
from minio.api import Minio
|
|
9
|
+
|
|
10
|
+
from pytest_databases.docker import TRUE_VALUES
|
|
11
|
+
from pytest_databases.helpers import get_xdist_worker_num
|
|
12
|
+
from pytest_databases.types import ServiceContainer, XdistIsolationLevel
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from collections.abc import Generator
|
|
16
|
+
|
|
17
|
+
from pytest_databases._service import DockerService
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class MinioService(ServiceContainer):
|
|
22
|
+
endpoint: str
|
|
23
|
+
access_key: str
|
|
24
|
+
secret_key: str
|
|
25
|
+
secure: bool
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.fixture(scope="session")
|
|
29
|
+
def minio_access_key() -> str:
|
|
30
|
+
return os.getenv("MINIO_ACCESS_KEY", "minio")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@pytest.fixture(scope="session")
|
|
34
|
+
def minio_secret_key() -> str:
|
|
35
|
+
return os.getenv("MINIO_SECRET_KEY", "minio123")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.fixture(scope="session")
|
|
39
|
+
def minio_secure() -> bool:
|
|
40
|
+
return os.getenv("MINIO_SECURE", "false").lower() in TRUE_VALUES
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@pytest.fixture(scope="session")
|
|
44
|
+
def xdist_minio_isolation_level() -> XdistIsolationLevel:
|
|
45
|
+
return "database"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@pytest.fixture(scope="session")
|
|
49
|
+
def minio_default_bucket_name(xdist_minio_isolation_level: XdistIsolationLevel) -> str:
|
|
50
|
+
worker_num = get_xdist_worker_num()
|
|
51
|
+
if worker_num is not None and xdist_minio_isolation_level == "server":
|
|
52
|
+
return f"pytest-databases-{worker_num}"
|
|
53
|
+
return "pytest-databases"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@pytest.fixture(scope="session")
|
|
57
|
+
def minio_service(
|
|
58
|
+
docker_service: "DockerService",
|
|
59
|
+
minio_access_key: str,
|
|
60
|
+
minio_secret_key: str,
|
|
61
|
+
minio_secure: bool,
|
|
62
|
+
) -> "Generator[MinioService, None, None]":
|
|
63
|
+
def check(_service: ServiceContainer) -> bool:
|
|
64
|
+
scheme = "https" if minio_secure else "http"
|
|
65
|
+
url = f"{scheme}://{_service.host}:{_service.port}/minio/health/ready"
|
|
66
|
+
if not url.startswith(("http:", "https:")):
|
|
67
|
+
msg = "URL must start with 'http:' or 'https:'"
|
|
68
|
+
raise ValueError(msg)
|
|
69
|
+
try:
|
|
70
|
+
with urlopen(url=Request(url, method="GET"), timeout=10) as response: # noqa: S310
|
|
71
|
+
return response.status == 200
|
|
72
|
+
except (URLError, ConnectionError):
|
|
73
|
+
return False
|
|
74
|
+
|
|
75
|
+
command = "server /data"
|
|
76
|
+
name = "minio"
|
|
77
|
+
env = {
|
|
78
|
+
"MINIO_ROOT_USER": minio_access_key,
|
|
79
|
+
"MINIO_ROOT_PASSWORD": minio_secret_key,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
with docker_service.run(
|
|
83
|
+
image="quay.io/minio/minio",
|
|
84
|
+
name=name,
|
|
85
|
+
command=command,
|
|
86
|
+
container_port=9000,
|
|
87
|
+
timeout=20,
|
|
88
|
+
pause=0.5,
|
|
89
|
+
env=env,
|
|
90
|
+
check=check,
|
|
91
|
+
) as service:
|
|
92
|
+
yield MinioService(
|
|
93
|
+
host=service.host,
|
|
94
|
+
port=service.port,
|
|
95
|
+
endpoint=f"{service.host}:{service.port}",
|
|
96
|
+
access_key=minio_access_key,
|
|
97
|
+
secret_key=minio_secret_key,
|
|
98
|
+
secure=minio_secure,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@pytest.fixture(scope="session")
|
|
103
|
+
def minio_client(
|
|
104
|
+
minio_service: "MinioService",
|
|
105
|
+
minio_default_bucket_name: str,
|
|
106
|
+
) -> "Generator[Minio, None, None]":
|
|
107
|
+
client = Minio(
|
|
108
|
+
endpoint=minio_service.endpoint,
|
|
109
|
+
access_key=minio_service.access_key,
|
|
110
|
+
secret_key=minio_service.secret_key,
|
|
111
|
+
secure=minio_service.secure,
|
|
112
|
+
)
|
|
113
|
+
try:
|
|
114
|
+
if not client.bucket_exists(minio_default_bucket_name):
|
|
115
|
+
client.make_bucket(minio_default_bucket_name)
|
|
116
|
+
except Exception as e:
|
|
117
|
+
msg = f"Failed to create bucket {minio_default_bucket_name}"
|
|
118
|
+
raise RuntimeError(msg) from e
|
|
119
|
+
else:
|
|
120
|
+
yield client
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import dataclasses
|
|
4
|
-
from typing import TYPE_CHECKING
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
7
|
from redis import Redis
|
|
@@ -11,6 +11,8 @@ from pytest_databases.helpers import get_xdist_worker_num
|
|
|
11
11
|
from pytest_databases.types import ServiceContainer, XdistIsolationLevel
|
|
12
12
|
|
|
13
13
|
if TYPE_CHECKING:
|
|
14
|
+
from collections.abc import Generator
|
|
15
|
+
|
|
14
16
|
from pytest_databases._service import DockerService
|
|
15
17
|
|
|
16
18
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
pytest_plugins = [
|
|
4
|
+
"pytest_databases.docker.minio",
|
|
5
|
+
]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_default_no_xdist(pytester: pytest.Pytester) -> None:
|
|
9
|
+
pytester.makepyfile("""
|
|
10
|
+
import pytest
|
|
11
|
+
from minio import Minio
|
|
12
|
+
|
|
13
|
+
pytest_plugins = [
|
|
14
|
+
"pytest_databases.docker.minio",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_one(minio_client: Minio) -> None:
|
|
19
|
+
minio_client.make_bucket("pytest-databases-test-no-xdist")
|
|
20
|
+
assert minio_client.bucket_exists("pytest-databases-test-no-xdist")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_two(minio_client: Minio) -> None:
|
|
24
|
+
assert minio_client.bucket_exists("pytest-databases-test-no-xdist")
|
|
25
|
+
""")
|
|
26
|
+
result = pytester.runpytest()
|
|
27
|
+
result.assert_outcomes(passed=2)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_xdist_isolate_server(pytester: pytest.Pytester) -> None:
|
|
31
|
+
pytester.makepyfile("""
|
|
32
|
+
import pytest
|
|
33
|
+
from minio import Minio
|
|
34
|
+
from pytest_databases.helpers import get_xdist_worker_num
|
|
35
|
+
pytest_plugins = [
|
|
36
|
+
"pytest_databases.docker.minio",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@pytest.fixture(scope="session")
|
|
41
|
+
def xdist_minio_isolation_level():
|
|
42
|
+
return "server"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_one(minio_client: Minio, minio_default_bucket_name: str) -> None:
|
|
46
|
+
assert minio_client.bucket_exists(minio_default_bucket_name)
|
|
47
|
+
isolated_bucket_name = f"{minio_default_bucket_name}-isolated-{get_xdist_worker_num()}"
|
|
48
|
+
assert not minio_client.bucket_exists(isolated_bucket_name)
|
|
49
|
+
minio_client.make_bucket(isolated_bucket_name)
|
|
50
|
+
assert minio_client.bucket_exists(isolated_bucket_name)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_two(minio_client: Minio, minio_default_bucket_name: str) -> None:
|
|
54
|
+
assert minio_client.bucket_exists(minio_default_bucket_name)
|
|
55
|
+
isolated_bucket_name = f"{minio_default_bucket_name}-isolated-{get_xdist_worker_num()}"
|
|
56
|
+
assert not minio_client.bucket_exists(isolated_bucket_name)
|
|
57
|
+
minio_client.make_bucket(isolated_bucket_name)
|
|
58
|
+
assert minio_client.bucket_exists(isolated_bucket_name)
|
|
59
|
+
""")
|
|
60
|
+
result = pytester.runpytest("-n", "2")
|
|
61
|
+
result.assert_outcomes(passed=2)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_xdist_isolate_database(pytester: pytest.Pytester) -> None:
|
|
65
|
+
pytester.makepyfile("""
|
|
66
|
+
from minio import Minio
|
|
67
|
+
from pytest_databases.helpers import get_xdist_worker_num
|
|
68
|
+
pytest_plugins = [
|
|
69
|
+
"pytest_databases.docker.minio",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_one(minio_client: Minio, minio_default_bucket_name: str) -> None:
|
|
74
|
+
assert minio_client.bucket_exists(minio_default_bucket_name)
|
|
75
|
+
isolated_bucket_name = f"{minio_default_bucket_name}-isolated-{get_xdist_worker_num()}"
|
|
76
|
+
assert not minio_client.bucket_exists(isolated_bucket_name)
|
|
77
|
+
minio_client.make_bucket(isolated_bucket_name)
|
|
78
|
+
assert minio_client.bucket_exists(isolated_bucket_name)
|
|
79
|
+
|
|
80
|
+
def test_two(minio_client: Minio, minio_default_bucket_name: str) -> None:
|
|
81
|
+
assert minio_client.bucket_exists(minio_default_bucket_name)
|
|
82
|
+
isolated_bucket_name = f"{minio_default_bucket_name}-isolated-{get_xdist_worker_num()}"
|
|
83
|
+
assert not minio_client.bucket_exists(isolated_bucket_name)
|
|
84
|
+
minio_client.make_bucket(isolated_bucket_name)
|
|
85
|
+
assert minio_client.bucket_exists(isolated_bucket_name)
|
|
86
|
+
|
|
87
|
+
""")
|
|
88
|
+
result = pytester.runpytest("-n", "2")
|
|
89
|
+
result.assert_outcomes(passed=2)
|