Skip to content

Commit 9a1f9ab

Browse files
authored
feat: add support for minio (#69)
Add support for `minio` pytest fixtures
1 parent 9c1fb36 commit 9a1f9ab

File tree

14 files changed

+1019
-970
lines changed

14 files changed

+1019
-970
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919

2020
# Ruff replaces black, flake8, autoflake and isort
2121
- repo: https://github.com/charliermarsh/ruff-pre-commit
22-
rev: "v0.9.6" # make sure this is always consistent with hatch configs
22+
rev: "v0.11.2" # make sure this is always consistent with hatch configs
2323
hooks:
2424
- id: ruff
2525
args: [--config, ./pyproject.toml]

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@
8888
"tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
8989
"tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
9090
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
91-
]
91+
],
92+
"python.analysis.extraPaths": ["${workspaceFolder}/src"]
9293
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pre-commit: ## Run pre-commit hooks
167167
.PHONY: slotscheck
168168
slotscheck: ## Run slotscheck
169169
@echo "${INFO} Running slots check... 🔍"
170-
@uv run slotscheck
170+
@uv run slotscheck src/pytest_databases
171171
@echo "${OK} Slots check passed ✨"
172172

173173
.PHONY: fix

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
Reusable test fixtures for any and all databases.
44

5-
<div align="center">
6-
5+
<!-- markdownlint-disable no-inline-html -->
76
<!-- prettier-ignore-start -->
7+
<p align="center">
88

9-
| Project | | Status |
9+
| Project | | Status |
1010
|-----------|:----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1111
| CI/CD | | [![Latest Release](https://github.com/litestar-org/pytest-databases/actions/workflows/release.yaml/badge.svg)](https://github.com/litestar-org/pytest-databases/actions/workflows/release.yaml) [![ci](https://github.com/litestar-org/pytest-databases/actions/workflows/ci.yaml/badge.svg)](https://github.com/litestar-org/pytest-databases/actions/workflows/ci.yaml) [![Documentation Building](https://github.com/litestar-org/pytest-databases/actions/workflows/docs.yaml/badge.svg?branch=main)](https://github.com/litestar-org/pytest-databases/actions/workflows/docs.yaml) |
1212
| Quality | | [![Coverage](https://codecov.io/github/litestar-org/pytest-databases/graph/badge.svg?token=vKez4Pycrc)](https://codecov.io/github/litestar-org/pytest-databases) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_pytest-databases&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_pytest-databases&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_pytest-databases&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_pytest-databases&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_pytest-databases) |
1313
| Package | | [![PyPI - Version](https://img.shields.io/pypi/v/pytest-databases?labelColor=202235&color=edb641&logo=python&logoColor=edb641)](https://badge.fury.io/py/pytest-databases) ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/pytest-databases?labelColor=202235&color=edb641&logo=python&logoColor=edb641) |
1414
| Community | | [![Discord](https://img.shields.io/discord/919193495116337154?labelColor=202235&color=edb641&label=chat%20on%20discord&logo=discord&logoColor=edb641)](https://discord.gg/litestar-919193495116337154) [![Matrix](https://img.shields.io/badge/chat%20on%20Matrix-bridged-202235?labelColor=202235&color=edb641&logo=matrix&logoColor=edb641)](https://matrix.to/#/#litestar:matrix.org) [![Medium](https://img.shields.io/badge/Medium-202235?labelColor=202235&color=edb641&logo=medium&logoColor=edb641)](https://blog.litestar.dev) [![Twitter](https://img.shields.io/twitter/follow/LitestarAPI?labelColor=202235&color=edb641&logo=twitter&logoColor=edb641&style=flat)](https://twitter.com/LitestarAPI) [![Blog](https://img.shields.io/badge/Blog-litestar.dev-202235?logo=blogger&labelColor=202235&color=edb641&logoColor=edb641)](https://blog.litestar.dev) |
1515
| Meta | | [![Litestar Project](https://img.shields.io/badge/Litestar%20Org-%E2%AD%90%20Litestar-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://github.com/litestar-org/pytest-databases) [![types - Mypy](https://img.shields.io/badge/types-Mypy-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://spdx.org/licenses/) [![Litestar Sponsors](https://img.shields.io/badge/Sponsor-%E2%9D%A4-%23edb641.svg?&logo=github&logoColor=edb641&labelColor=202235)](https://github.com/sponsors/litestar-org) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json&labelColor=202235)](https://github.com/astral-sh/ruff) [![code style - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json&labelColor=202235)](https://github.com/psf/black)|
1616

17+
</p>
18+
1719
<!-- prettier-ignore-end -->
18-
</div>
1920

2021
> [!WARNING]
2122
>
@@ -30,7 +31,7 @@ It is designed to offer pre-configured testing setups for many different types a
3031

3132
## Features
3233

33-
`pytest-databases` currently utilizes `docker compose` (or the legacy `docker-compose`) commands to manage the startup and shutdown of each database service. The following databases are currently available:
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:
3435

3536
- **Postgres**: Version 12, 13, 14, 15, 16 and 17 are available
3637
- **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
4647
- **KeyDB**: Latest version
4748
- **Elasticsearch**: Version 7 and 8 are available
4849
- **Azure blob storage**: Via azurite
50+
- **Minio**: Latest version
4951

5052
## Contributing
5153

@@ -56,9 +58,8 @@ Before contributing, please review the [contribution guide][contributing].
5658
If you have any questions, reach out to us on [Discord][discord], our org-wide [GitHub discussions][litestar-discussions] page,
5759
or the [project-specific GitHub discussions page][project-discussions].
5860

59-
<hr>
60-
6161
<!-- markdownlint-disable -->
62+
<hr>
6263
<p align="center">
6364
<!-- github-banner-start -->
6465
<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].
7374
[project-discussions]: https://github.com/litestar-org/pytest-databases/discussions
7475
[project-docs]: https://docs.pytest-databases.litestar.dev
7576
[install-guide]: https://docs.pytest-databases.litestar.dev/latest/#installation
76-
[newrepo]: https://github.com/organizations/litestar-org/repositories/new?template=pytest-databases

pyproject.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ readme = "README.md"
1414
requires-python = ">=3.9"
1515
version = "0.11.1"
1616
#
17-
authors = [{ name = "Cody Fincher", email = "cody.fincher@gmail.com" }]
17+
authors = [{ name = "Cody Fincher", email = "cody@litestar.dev" }]
1818
keywords = [
1919
"database",
2020
"migration",
@@ -61,27 +61,28 @@ elasticsearch7 = ["elasticsearch7"]
6161
elasticsearch8 = ["elasticsearch8"]
6262
keydb = ["redis"]
6363
mariadb = ["mariadb"]
64-
mssql = ["pymssql<=2.3.1"]
64+
minio = ["minio"]
65+
mssql = ["pymssql"]
6566
mysql = ["mysql-connector-python"]
6667
oracle = ["oracledb"]
6768
postgres = ["psycopg>=3"]
6869
redis = ["redis"]
6970
spanner = ["google-cloud-spanner"]
7071

71-
7272
[dependency-groups]
7373
dev = [
7474
# tests
7575
"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]",
7877
"coverage[toml]>=6.2",
7978
"pytest",
8079
"pytest-cov",
80+
"pytest-cdist>=0.2",
8181
"pytest-mock",
82-
"pytest-vcr",
8382
"pytest-click",
8483
"pytest-xdist",
84+
"pytest-sugar",
85+
"slotscheck",
8586
# lint
8687
"mypy",
8788
"ruff",
@@ -104,7 +105,7 @@ dev = [
104105
"sphinx-design>=0.5.0",
105106
"sphinxcontrib-mermaid>=0.9.2",
106107
"auto-pytabs[sphinx]>=0.4.0",
107-
"pytest-cdist>=0.2",
108+
108109
]
109110

110111

@@ -116,7 +117,7 @@ dev = [
116117
allow_dirty = true
117118
commit = true
118119
commit_args = "--no-verify"
119-
current_version = "0.11.0"
120+
current_version = "0.11.1"
120121
ignore_missing_files = false
121122
ignore_missing_version = false
122123
message = "chore(release): bump to v{new_version}"
@@ -295,7 +296,7 @@ lint.select = ["ALL"]
295296
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
296297
preview = true # preview features & checks, use with caution
297298
src = ["src", "tests/", "docs/"]
298-
target-version = "py38"
299+
target-version = "py39"
299300

300301
[tool.ruff.lint.pydocstyle]
301302
convention = "google"

scripts/build_docs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import subprocess # noqa: S404
66
from contextlib import contextmanager
77
from pathlib import Path
8-
from typing import Generator
8+
from typing import TYPE_CHECKING
9+
10+
if TYPE_CHECKING:
11+
from collections.abc import Generator
912

1013
REDIRECT_TEMPLATE = """
1114
<!DOCTYPE HTML>

src/pytest_databases/_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import subprocess # noqa: S404
77
import time
88
from contextlib import AbstractContextManager, contextmanager
9-
from typing import TYPE_CHECKING, Any, Callable, Generator
9+
from typing import TYPE_CHECKING, Any, Callable
1010

1111
import filelock
1212
import pytest
@@ -19,6 +19,7 @@
1919

2020
if TYPE_CHECKING:
2121
import pathlib
22+
from collections.abc import Generator
2223
from types import TracebackType
2324

2425
from docker.models.containers import Container

src/pytest_databases/docker/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
import time
77
import timeit
88
from contextlib import AbstractContextManager
9-
from typing import TYPE_CHECKING, Any, Callable, Iterable
9+
from typing import TYPE_CHECKING, Any, Callable
1010

1111
from pytest_databases.helpers import simple_string_hash
1212

1313
if TYPE_CHECKING:
14-
from collections.abc import Awaitable, Generator
14+
from collections.abc import Awaitable, Generator, Iterable
1515
from pathlib import Path
1616
from types import TracebackType
1717

18-
TRUE_VALUES = {"True", "true", "1", "yes", "Y", "T"}
18+
TRUE_VALUES = {"True", "true", "1", "yes", "y", "Y", "T", "on", "enabled", "ok"}
1919

2020

2121
def wait_until_responsive(

src/pytest_databases/docker/azure_blob.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass
4-
from typing import TYPE_CHECKING, AsyncGenerator, Generator
4+
from typing import TYPE_CHECKING
55

66
import pytest
77
from azure.storage.blob import ContainerClient
@@ -11,6 +11,8 @@
1111
from pytest_databases.types import ServiceContainer, XdistIsolationLevel
1212

1313
if TYPE_CHECKING:
14+
from collections.abc import AsyncGenerator, Generator
15+
1416
from pytest_databases._service import DockerService
1517

1618

src/pytest_databases/docker/mariadb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import contextlib
44
import traceback
5+
from collections.abc import Generator
56
from dataclasses import dataclass
6-
from typing import TYPE_CHECKING, Generator
7+
from typing import TYPE_CHECKING
78

89
import mariadb
910
import pytest

0 commit comments

Comments
 (0)