Skip to main content

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)

Source distribution for pytest-service 0.0.2
File Size Uploaded
pytest_service-0.0.2.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-service 0.0.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page