pytest-service
Inspired by pytest-pg but with MongoDB onboard
How to use
Postgres
@pytest.fixture(scope="session")
def pg_14_local() -> Iterator:
with pytest_service.PGService("postgres:14.4-alpine").run() as pg:
yield pg
@pytest.fixture(scope="session", autouse=True)
def init_env(pg_14_local: pytest_service.PG) -> None:
if not pg_14_local:
return
os.environ["POSTGRES_DBNAME"] = pg_14_local.database
os.environ["POSTGRES_USER"] = pg_14_local.user
os.environ["POSTGRES_PASSWORD"] = pg_14_local.password
os.environ["POSTGRES_HOST"] = pg_14_local.host
os.environ["POSTGRES_PORT"] = str(pg_14_local.port)
MongoDB
@pytest.fixture(scope="session")
def mongo_6_local() -> Iterator:
with pytest_service.MongoDBService("mongo:6").run() as mongo:
yield mongo
@pytest.fixture(scope="session", autouse=True)
def init_env(mongo_6_local: pytest_service.Mongo) -> None:
if not mongo_6_local:
return
os.environ["MONGODB_CONNECTION_STRING"] = mongo_6_local.connection_string
Metadata
Release files for pytest-service 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_service-0.0.2.tar.gz | 7.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_service-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / pytest_service-0.0.2.tar.gz
| Download URL | pytest_service-0.0.2.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e83487283e73633435c03d1af0595d391206fe75c42bd483eee49742affa1b40
|
|
BLAKE2b-256 checksum How to use checksums |
6ca24ec707ec207f255ad4a5295aea100bd9beae627c13a1cd24683f7f9b0ffa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / pytest_service-0.0.2-py3-none-any.whl
| Download URL | pytest_service-0.0.2-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80e5d1cdc655f55b3be96aca2733b7a8ccd050549e2e63d3e1f49a3fad1c298d
|
|
BLAKE2b-256 checksum How to use checksums |
9660a6b85660bef667a265a35925d90656fab85f2aa20a0bbf08a9ad715c99e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|