pytest-databases 0.12.3__tar.gz → 0.13.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.12.3 → pytest_databases-0.13.0}/.github/workflows/ci.yaml +3 -3
- pytest_databases-0.13.0/.github/workflows/docs.yml +52 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.github/workflows/release.yaml +1 -1
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.pre-commit-config.yaml +1 -1
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/CONTRIBUTING.rst +3 -7
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/Makefile +1 -1
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/PKG-INFO +66 -49
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/README.md +62 -47
- pytest_databases-0.13.0/docs/.gitignore +26 -0
- pytest_databases-0.13.0/docs/_static/custom.css +149 -0
- pytest_databases-0.13.0/docs/_static/logo.svg +9 -0
- pytest_databases-0.13.0/docs/changelog.rst +4 -0
- pytest_databases-0.13.0/docs/conf.py +70 -0
- pytest_databases-0.13.0/docs/contribution-guide.rst +3 -0
- pytest_databases-0.13.0/docs/getting-started/basic-usage.rst +34 -0
- pytest_databases-0.13.0/docs/getting-started/configuration.rst +43 -0
- pytest_databases-0.13.0/docs/getting-started/enabling-plugins.rst +13 -0
- pytest_databases-0.13.0/docs/getting-started/index.rst +13 -0
- pytest_databases-0.13.0/docs/getting-started/installation.rst +58 -0
- pytest_databases-0.13.0/docs/getting-started/next-steps.rst +4 -0
- pytest_databases-0.13.0/docs/index.rst +76 -0
- pytest_databases-0.13.0/docs/supported-databases/azure_blob_storage.rst +61 -0
- pytest_databases-0.13.0/docs/supported-databases/bigquery.rst +53 -0
- pytest_databases-0.13.0/docs/supported-databases/cockroachdb.rst +53 -0
- pytest_databases-0.13.0/docs/supported-databases/elasticsearch.rst +97 -0
- pytest_databases-0.13.0/docs/supported-databases/index.rst +21 -0
- pytest_databases-0.13.0/docs/supported-databases/mariadb.rst +64 -0
- pytest_databases-0.13.0/docs/supported-databases/minio.rst +68 -0
- pytest_databases-0.13.0/docs/supported-databases/mysql.rst +61 -0
- pytest_databases-0.13.0/docs/supported-databases/oracle.rst +62 -0
- pytest_databases-0.13.0/docs/supported-databases/postgres.rst +65 -0
- pytest_databases-0.13.0/docs/supported-databases/redis.rst +57 -0
- pytest_databases-0.13.0/docs/supported-databases/spanner.rst +61 -0
- pytest_databases-0.13.0/docs/supported-databases/sqlserver.rst +59 -0
- pytest_databases-0.13.0/docs/supported-databases/valkey.rst +52 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/pyproject.toml +23 -11
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/scripts/build_docs.py +1 -1
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/_service.py +17 -12
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/bigquery.py +7 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/mysql.py +13 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/postgres.py +94 -6
- pytest_databases-0.13.0/src/pytest_databases/docker/redis.py +162 -0
- pytest_databases-0.13.0/src/pytest_databases/docker/valkey.py +78 -0
- pytest_databases-0.13.0/src/pytest_databases/helpers.py +77 -0
- pytest_databases-0.13.0/src/pytest_databases/py.typed +0 -0
- pytest_databases-0.13.0/tests/__init__.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/conftest.py +5 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_mssql.py +6 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_mysql.py +2 -2
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_postgres.py +4 -0
- pytest_databases-0.13.0/tests/test_redis.py +131 -0
- pytest_databases-0.13.0/tests/test_valkey.py +87 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/uv.lock +1683 -1499
- pytest_databases-0.12.3/src/pytest_databases/docker/alloydb_omni.py +0 -65
- pytest_databases-0.12.3/src/pytest_databases/docker/redis.py +0 -78
- pytest_databases-0.12.3/src/pytest_databases/helpers.py +0 -37
- pytest_databases-0.12.3/tests/test_alloydb_omni.py +0 -90
- pytest_databases-0.12.3/tests/test_redis.py +0 -112
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.github/CODEOWNERS +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.github/dependabot.yaml +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.github/workflows/cd.yaml +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.github/workflows/pr-title.yaml +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.gitignore +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.sourcery.yaml +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.vscode/launch.json +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/.vscode/settings.json +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/CODEOWNERS +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/LICENSE +0 -0
- {pytest_databases-0.12.3/scripts → pytest_databases-0.13.0/docs}/__init__.py +0 -0
- /pytest_databases-0.12.3/src/pytest_databases/py.typed → /pytest_databases-0.13.0/docs/_static/.gitkeep +0 -0
- {pytest_databases-0.12.3/tests → pytest_databases-0.13.0/scripts}/__init__.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/scripts/convert_docs.sh +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/scripts/install-hatch.sh +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/sonar-project.properties +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/__init__.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/__metadata__.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/__init__.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/azure_blob.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/cockroachdb.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/elastic_search.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/mariadb.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/minio.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/mssql.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/oracle.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/docker/spanner.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/src/pytest_databases/types.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_azure_blob.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_bigquery.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_cockroachdb.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_elasticsearch.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_mariadb.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_minio.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_oracle.py +0 -0
- {pytest_databases-0.12.3 → pytest_databases-0.13.0}/tests/test_spanner.py +0 -0
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
python-version: ${{ matrix.python-version }}
|
|
38
38
|
|
|
39
39
|
- name: Install uv
|
|
40
|
-
uses: astral-sh/setup-uv@
|
|
40
|
+
uses: astral-sh/setup-uv@v6
|
|
41
41
|
|
|
42
42
|
- name: Intall dependencies
|
|
43
43
|
run: uv sync --frozen
|
|
@@ -58,7 +58,7 @@ jobs:
|
|
|
58
58
|
|
|
59
59
|
- if: matrix.python-version == '3.12'
|
|
60
60
|
name: Upload coverage reports to Codecov
|
|
61
|
-
uses: codecov/codecov-action@v5.4.
|
|
61
|
+
uses: codecov/codecov-action@v5.4.3
|
|
62
62
|
with:
|
|
63
63
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
64
64
|
slug: litestar-org/pytest-databases
|
|
@@ -78,7 +78,7 @@ jobs:
|
|
|
78
78
|
python-version: 3.9
|
|
79
79
|
|
|
80
80
|
- name: Install uv
|
|
81
|
-
uses: astral-sh/setup-uv@
|
|
81
|
+
uses: astral-sh/setup-uv@v6
|
|
82
82
|
|
|
83
83
|
- name: Intall dependencies
|
|
84
84
|
run: uv sync --frozen
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Documentation Building
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
# Allows you to run this workflow manually from the Actions tab
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build_and_deploy:
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
pages: write
|
|
17
|
+
id-token: write
|
|
18
|
+
environment:
|
|
19
|
+
name: github-pages
|
|
20
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Install additional dependencies
|
|
26
|
+
run: sudo apt-get update && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 libmariadb-dev && sudo apt-get autoremove -y && sudo apt-get clean -y
|
|
27
|
+
|
|
28
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
29
|
+
uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: 3.12
|
|
32
|
+
|
|
33
|
+
- name: Install uv
|
|
34
|
+
uses: astral-sh/setup-uv@v6
|
|
35
|
+
|
|
36
|
+
- name: Set up Python
|
|
37
|
+
run: uv python install 3.12
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
run: uv sync --all-extras --dev
|
|
41
|
+
|
|
42
|
+
- name: Build Release Documentation
|
|
43
|
+
run: uv run scripts/build_docs.py dist/docs
|
|
44
|
+
|
|
45
|
+
- name: Upload artifact
|
|
46
|
+
uses: actions/upload-pages-artifact@v3
|
|
47
|
+
with:
|
|
48
|
+
path: dist/docs/
|
|
49
|
+
|
|
50
|
+
- name: Deploy to GitHub Pages
|
|
51
|
+
id: deployment
|
|
52
|
+
uses: actions/deploy-pages@v4
|
|
@@ -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.11.
|
|
22
|
+
rev: "v0.11.11" # make sure this is always consistent with hatch configs
|
|
23
23
|
hooks:
|
|
24
24
|
- id: ruff
|
|
25
25
|
args: [--config, ./pyproject.toml]
|
|
@@ -4,12 +4,8 @@ Contribution guide
|
|
|
4
4
|
Setting up the environment
|
|
5
5
|
--------------------------
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2. ``make install
|
|
9
|
-
3. ``make configure-hatch``
|
|
10
|
-
4. ``make install``
|
|
11
|
-
5. Install `pre-commit <https://pre-commit.com/>`_
|
|
12
|
-
6. ``pre-commit install``
|
|
7
|
+
1. `Install MariaDB <https://mariadb.com/kb/en/binary-packages/>`_
|
|
8
|
+
2. ``make install``
|
|
13
9
|
|
|
14
10
|
Code contributions
|
|
15
11
|
------------------
|
|
@@ -46,7 +42,7 @@ Guidelines for writing code
|
|
|
46
42
|
Writing and running tests
|
|
47
43
|
+++++++++++++++++++++++++
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
Coming soon.
|
|
50
46
|
|
|
51
47
|
Project documentation
|
|
52
48
|
---------------------
|
|
@@ -118,7 +118,7 @@ clean: ## Cleanup temporary build a
|
|
|
118
118
|
.PHONY: test
|
|
119
119
|
test: ## Run the tests
|
|
120
120
|
@echo "${INFO} Running test cases... 🧪"
|
|
121
|
-
@uv run pytest
|
|
121
|
+
@uv run pytest --quiet --runpytest subprocess
|
|
122
122
|
@echo "${OK} Tests passed ✨"
|
|
123
123
|
|
|
124
124
|
.PHONY: coverage
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-databases
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.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
|
|
@@ -8,7 +8,7 @@ Project-URL: Source, https://github.com/litestar-org/pytest-databases
|
|
|
8
8
|
Author-email: Cody Fincher <cody@litestar.dev>
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Keywords: alloydb,alloydbomni,azure,bigquery,cockroachdb,database,duckdb,elasticsearch,migration,mssql,mysql,oracle,postgres,redis,spanner
|
|
11
|
+
Keywords: alloydb,alloydbomni,azure,bigquery,cockroachdb,database,dragonflydb,duckdb,elasticsearch,migration,mssql,mysql,oracle,postgres,redis,spanner,valkey
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -52,41 +52,36 @@ Provides-Extra: redis
|
|
|
52
52
|
Requires-Dist: redis; extra == 'redis'
|
|
53
53
|
Provides-Extra: spanner
|
|
54
54
|
Requires-Dist: google-cloud-spanner; extra == 'spanner'
|
|
55
|
+
Provides-Extra: valkey
|
|
56
|
+
Requires-Dist: valkey; extra == 'valkey'
|
|
55
57
|
Description-Content-Type: text/markdown
|
|
56
58
|
|
|
57
|
-
# Pytest Databases
|
|
58
|
-
|
|
59
|
-
Reusable test fixtures for any and all databases.
|
|
60
|
-
|
|
61
59
|
<!-- markdownlint-disable no-inline-html -->
|
|
62
60
|
<!-- prettier-ignore-start -->
|
|
63
|
-
<
|
|
61
|
+
<div align="center">
|
|
64
62
|
|
|
65
|
-
| Project | | Status
|
|
66
|
-
|
|
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://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)
|
|
69
|
-
| Package | | [](https://badge.fury.io/py/pytest-databases) 
|
|
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)
|
|
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)|
|
|
63
|
+
| Project | | Status |
|
|
64
|
+
| --------- | :-- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
65
|
+
| 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.yml) |
|
|
66
|
+
| 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) |
|
|
67
|
+
| Package | | [](https://badge.fury.io/py/pytest-databases)  |
|
|
68
|
+
| 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
|
+
| 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) |
|
|
72
70
|
|
|
73
|
-
</
|
|
71
|
+
</div>
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
> [!WARNING]
|
|
78
|
-
>
|
|
79
|
-
> Please note that pytest-databases is currently in a pre-release stage of development. This means the library is still under
|
|
80
|
-
> active development, and its initial API is subject to change. We encourage developers to experiment with pytest-databases and provide
|
|
81
|
-
> feedback, but we recommend against using it in production environments until a stable release is available.`
|
|
82
|
-
|
|
83
|
-
## About
|
|
73
|
+
# Pytest Databases
|
|
84
74
|
|
|
85
|
-
|
|
86
|
-
It is designed to offer pre-configured testing setups for many different types and versions of databases.
|
|
75
|
+
Ready-made database fixtures for your pytest tests.
|
|
87
76
|
|
|
88
77
|
## Features
|
|
89
78
|
|
|
79
|
+
- 🚀 Easy-to-use database fixtures
|
|
80
|
+
- 🔄 Support for multiple database types
|
|
81
|
+
- 🐳 Docker integration for isolated testing environments
|
|
82
|
+
- ⚡ Fast and efficient test execution
|
|
83
|
+
- 🔧 Highly configurable
|
|
84
|
+
|
|
90
85
|
`pytest-databases` uses the Docker Python SDK to manage the startup and shutdown of database services in containers. The following databases are currently available:
|
|
91
86
|
|
|
92
87
|
- **Postgres**: Version 12, 13, 14, 15, 16 and 17 are available
|
|
@@ -105,28 +100,50 @@ It is designed to offer pre-configured testing setups for many different types a
|
|
|
105
100
|
- **Azure blob storage**: Via azurite
|
|
106
101
|
- **Minio**: Latest version
|
|
107
102
|
|
|
103
|
+
## Installation
|
|
104
|
+
|
|
105
|
+
Quick install for postgres:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install pytest-databases[postgres]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Quick Start
|
|
112
|
+
|
|
113
|
+
- Add to your pytest `conftest.py`:
|
|
114
|
+
|
|
115
|
+
```py
|
|
116
|
+
pytest_plugins = ["pytest_databases.docker.postgres"]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- Use in your tests:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from pytest_databases.docker.postgres import PostgresService
|
|
123
|
+
import psycopg
|
|
124
|
+
|
|
125
|
+
def test_one(postgres_service: PostgresService) -> None:
|
|
126
|
+
with psycopg.connect(
|
|
127
|
+
f"postgresql://{postgres_service.user}:{postgres_service.password}@{postgres_service.host}:{postgres_service.port}/{postgres_service.database}",
|
|
128
|
+
autocommit=True,
|
|
129
|
+
) as conn:
|
|
130
|
+
result = conn.execute("SELECT 1")
|
|
131
|
+
assert result
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Documentation
|
|
135
|
+
|
|
136
|
+
Full documentation is available at [https://pytest-databases.readthedocs.io/](https://pytest-databases.readthedocs.io/)
|
|
137
|
+
|
|
108
138
|
## Contributing
|
|
109
139
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<!-- github-banner-start -->
|
|
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" />
|
|
122
|
-
<br>A <a href="https://github.com/litestar-org">Litestar Organization</a> Project
|
|
123
|
-
<!-- github-banner-end -->
|
|
124
|
-
</p>
|
|
125
|
-
|
|
126
|
-
[litestar-org]: https://github.com/litestar-org
|
|
127
|
-
[contributing]: https://docs.pytest-databases.litestar.dev/latest/contribution-guide.html
|
|
128
|
-
[discord]: https://discord.gg/litestar-919193495116337154
|
|
129
|
-
[litestar-discussions]: https://github.com/orgs/litestar-org/discussions
|
|
130
|
-
[project-discussions]: https://github.com/litestar-org/pytest-databases/discussions
|
|
131
|
-
[project-docs]: https://docs.pytest-databases.litestar.dev
|
|
132
|
-
[install-guide]: https://docs.pytest-databases.litestar.dev/latest/#installation
|
|
140
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
145
|
+
|
|
146
|
+
## Acknowledgments
|
|
147
|
+
|
|
148
|
+
- The Litestar Framework team
|
|
149
|
+
- The pytest community
|
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
# Pytest Databases
|
|
2
|
-
|
|
3
|
-
Reusable test fixtures for any and all databases.
|
|
4
|
-
|
|
5
1
|
<!-- markdownlint-disable no-inline-html -->
|
|
6
2
|
<!-- prettier-ignore-start -->
|
|
7
|
-
<
|
|
3
|
+
<div align="center">
|
|
8
4
|
|
|
9
|
-
| Project | | Status
|
|
10
|
-
|
|
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://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)
|
|
13
|
-
| Package | | [](https://badge.fury.io/py/pytest-databases) 
|
|
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
|
-
| 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)|
|
|
5
|
+
| Project | | Status |
|
|
6
|
+
| --------- | :-- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| 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.yml) |
|
|
8
|
+
| 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) |
|
|
9
|
+
| Package | | [](https://badge.fury.io/py/pytest-databases)  |
|
|
10
|
+
| Community | | [](https://discord.gg/litestar-919193495116337154) [](https://matrix.to/#/#litestar:matrix.org) [](https://blog.litestar.dev) [](https://twitter.com/LitestarAPI) [](https://blog.litestar.dev) |
|
|
11
|
+
| 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
12
|
|
|
17
|
-
</
|
|
13
|
+
</div>
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
> [!WARNING]
|
|
22
|
-
>
|
|
23
|
-
> Please note that pytest-databases is currently in a pre-release stage of development. This means the library is still under
|
|
24
|
-
> active development, and its initial API is subject to change. We encourage developers to experiment with pytest-databases and provide
|
|
25
|
-
> feedback, but we recommend against using it in production environments until a stable release is available.`
|
|
26
|
-
|
|
27
|
-
## About
|
|
15
|
+
# Pytest Databases
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
It is designed to offer pre-configured testing setups for many different types and versions of databases.
|
|
17
|
+
Ready-made database fixtures for your pytest tests.
|
|
31
18
|
|
|
32
19
|
## Features
|
|
33
20
|
|
|
21
|
+
- 🚀 Easy-to-use database fixtures
|
|
22
|
+
- 🔄 Support for multiple database types
|
|
23
|
+
- 🐳 Docker integration for isolated testing environments
|
|
24
|
+
- ⚡ Fast and efficient test execution
|
|
25
|
+
- 🔧 Highly configurable
|
|
26
|
+
|
|
34
27
|
`pytest-databases` uses the Docker Python SDK to manage the startup and shutdown of database services in containers. The following databases are currently available:
|
|
35
28
|
|
|
36
29
|
- **Postgres**: Version 12, 13, 14, 15, 16 and 17 are available
|
|
@@ -49,28 +42,50 @@ It is designed to offer pre-configured testing setups for many different types a
|
|
|
49
42
|
- **Azure blob storage**: Via azurite
|
|
50
43
|
- **Minio**: Latest version
|
|
51
44
|
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
Quick install for postgres:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install pytest-databases[postgres]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
- Add to your pytest `conftest.py`:
|
|
56
|
+
|
|
57
|
+
```py
|
|
58
|
+
pytest_plugins = ["pytest_databases.docker.postgres"]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- Use in your tests:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from pytest_databases.docker.postgres import PostgresService
|
|
65
|
+
import psycopg
|
|
66
|
+
|
|
67
|
+
def test_one(postgres_service: PostgresService) -> None:
|
|
68
|
+
with psycopg.connect(
|
|
69
|
+
f"postgresql://{postgres_service.user}:{postgres_service.password}@{postgres_service.host}:{postgres_service.port}/{postgres_service.database}",
|
|
70
|
+
autocommit=True,
|
|
71
|
+
) as conn:
|
|
72
|
+
result = conn.execute("SELECT 1")
|
|
73
|
+
assert result
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
|
|
78
|
+
Full documentation is available at [https://pytest-databases.readthedocs.io/](https://pytest-databases.readthedocs.io/)
|
|
79
|
+
|
|
52
80
|
## Contributing
|
|
53
81
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<!-- github-banner-start -->
|
|
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" />
|
|
66
|
-
<br>A <a href="https://github.com/litestar-org">Litestar Organization</a> Project
|
|
67
|
-
<!-- github-banner-end -->
|
|
68
|
-
</p>
|
|
69
|
-
|
|
70
|
-
[litestar-org]: https://github.com/litestar-org
|
|
71
|
-
[contributing]: https://docs.pytest-databases.litestar.dev/latest/contribution-guide.html
|
|
72
|
-
[discord]: https://discord.gg/litestar-919193495116337154
|
|
73
|
-
[litestar-discussions]: https://github.com/orgs/litestar-org/discussions
|
|
74
|
-
[project-discussions]: https://github.com/litestar-org/pytest-databases/discussions
|
|
75
|
-
[project-docs]: https://docs.pytest-databases.litestar.dev
|
|
76
|
-
[install-guide]: https://docs.pytest-databases.litestar.dev/latest/#installation
|
|
82
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
87
|
+
|
|
88
|
+
## Acknowledgments
|
|
89
|
+
|
|
90
|
+
- The Litestar Framework team
|
|
91
|
+
- The pytest community
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Sphinx documentation
|
|
2
|
+
_build/
|
|
3
|
+
.buildinfo
|
|
4
|
+
.doctrees/
|
|
5
|
+
|
|
6
|
+
# Python
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
|
|
11
|
+
# Environment
|
|
12
|
+
.env
|
|
13
|
+
.venv
|
|
14
|
+
env/
|
|
15
|
+
venv/
|
|
16
|
+
ENV/
|
|
17
|
+
|
|
18
|
+
# IDE
|
|
19
|
+
.idea/
|
|
20
|
+
.vscode/
|
|
21
|
+
*.swp
|
|
22
|
+
*.swo
|
|
23
|
+
|
|
24
|
+
# OS
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/* Theme color definitions */
|
|
2
|
+
:root {
|
|
3
|
+
--brand-font-size-xl: 6rem;
|
|
4
|
+
--brand-font-size-lg: 5rem;
|
|
5
|
+
--brand-font-size-md: 4rem;
|
|
6
|
+
--brand-font-size-sm: 2.5rem;
|
|
7
|
+
--brand-font-size-xs: 1.8rem;
|
|
8
|
+
--brand-font-size-xxs: 1.6rem;
|
|
9
|
+
|
|
10
|
+
--brand-letter-spacing-xl: 0.25em;
|
|
11
|
+
--brand-letter-spacing-lg: 0.2em;
|
|
12
|
+
--brand-letter-spacing-md: 0.1em;
|
|
13
|
+
--brand-letter-spacing-sm: 0.05em;
|
|
14
|
+
--brand-letter-spacing-xs: 0.03em;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html.light {
|
|
18
|
+
--sl-color-primary: #202235;
|
|
19
|
+
--sl-color-secondary: #edb641;
|
|
20
|
+
--sl-color-accent: #ffd480;
|
|
21
|
+
--sl-color-text-1: var(--sl-color-primary);
|
|
22
|
+
--sl-color-text-2: var(--sl-color-secondary);
|
|
23
|
+
--sy-c-foot-background: #f0f0f0;
|
|
24
|
+
--yue-c-text: #000;
|
|
25
|
+
--brand-text-glow: 0 0 10px rgba(32, 34, 53, 0.3),
|
|
26
|
+
0 0 20px rgba(32, 34, 53, 0.2), 0 0 30px rgba(237, 182, 65, 0.1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
html.dark {
|
|
30
|
+
--sl-color-text-1: var(--sl-color-secondary);
|
|
31
|
+
--sy-c-foot-background: black;
|
|
32
|
+
--yue-c-text: #fff;
|
|
33
|
+
--brand-text-glow: 0 0 10px rgba(237, 182, 65, 0.4),
|
|
34
|
+
0 0 20px rgba(237, 182, 65, 0.3), 0 0 30px rgba(237, 182, 65, 0.2);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.title-with-logo {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
margin: 5rem auto 4rem;
|
|
42
|
+
width: 100%;
|
|
43
|
+
padding: 0 2rem;
|
|
44
|
+
user-select: none;
|
|
45
|
+
-webkit-user-select: none;
|
|
46
|
+
-moz-user-select: none;
|
|
47
|
+
-ms-user-select: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
html[class] .title-with-logo .brand-text {
|
|
51
|
+
font-family: var(--sl-font-sans);
|
|
52
|
+
font-weight: 300;
|
|
53
|
+
font-size: var(--brand-font-size-lg);
|
|
54
|
+
letter-spacing: var(--brand-letter-spacing-xl);
|
|
55
|
+
text-transform: uppercase;
|
|
56
|
+
text-align: center;
|
|
57
|
+
line-height: 1.4;
|
|
58
|
+
max-width: 100%;
|
|
59
|
+
word-break: break-word;
|
|
60
|
+
word-wrap: break-word;
|
|
61
|
+
overflow-wrap: break-word;
|
|
62
|
+
hyphens: auto;
|
|
63
|
+
-webkit-hyphens: auto;
|
|
64
|
+
-ms-hyphens: auto;
|
|
65
|
+
transition: color var(--sl-transition), text-shadow var(--sl-transition);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
html.light .title-with-logo .brand-text {
|
|
69
|
+
color: var(--sl-color-text-1);
|
|
70
|
+
text-shadow: var(--brand-text-glow);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
html.dark .title-with-logo .brand-text {
|
|
74
|
+
color: var(--sl-color-text-2);
|
|
75
|
+
text-shadow: var(--brand-text-glow);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Button container wrapping */
|
|
79
|
+
.buttons.wrap {
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-wrap: wrap;
|
|
82
|
+
gap: 0.5rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.buttons.wrap .btn-no-wrap {
|
|
86
|
+
flex: 0 0 auto;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Large screens */
|
|
90
|
+
@media (min-width: 1200px) {
|
|
91
|
+
html[class] .title-with-logo .brand-text {
|
|
92
|
+
font-size: var(--brand-font-size-xl);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Medium-small screens */
|
|
97
|
+
@media (max-width: 991px) {
|
|
98
|
+
html[class] .title-with-logo .brand-text {
|
|
99
|
+
font-size: var(--brand-font-size-md);
|
|
100
|
+
letter-spacing: var(--brand-letter-spacing-lg);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Small screens */
|
|
105
|
+
@media (max-width: 767px) {
|
|
106
|
+
html[class] .title-with-logo .brand-text {
|
|
107
|
+
font-size: var(--brand-font-size-sm);
|
|
108
|
+
letter-spacing: var(--brand-letter-spacing-md);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
html[class] .title-with-logo {
|
|
112
|
+
margin: 2rem auto 1.5rem;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Extra small screens */
|
|
117
|
+
@media (max-width: 480px) {
|
|
118
|
+
html[class] .title-with-logo .brand-text {
|
|
119
|
+
font-size: var(--brand-font-size-xs);
|
|
120
|
+
letter-spacing: var(--brand-letter-spacing-sm);
|
|
121
|
+
line-height: 1.2;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
html[class] .title-with-logo {
|
|
125
|
+
margin: 1.5rem auto 1rem;
|
|
126
|
+
padding: 0 1rem;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Smallest screens */
|
|
131
|
+
@media (max-width: 360px) {
|
|
132
|
+
html[class] .title-with-logo .brand-text {
|
|
133
|
+
font-size: var(--brand-font-size-xxs);
|
|
134
|
+
letter-spacing: var(--brand-letter-spacing-xs);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* Preserve existing layout styles */
|
|
139
|
+
#badges img {
|
|
140
|
+
margin-top: 0;
|
|
141
|
+
margin-bottom: 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#badges {
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-wrap: wrap;
|
|
147
|
+
gap: 10px;
|
|
148
|
+
margin-bottom: 3em;
|
|
149
|
+
}
|