No project description provided
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest_service-0.0.2.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_service-0.0.2.tar.gz.
File metadata
- Download URL: pytest_service-0.0.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e83487283e73633435c03d1af0595d391206fe75c42bd483eee49742affa1b40
|
|
| MD5 |
481818b9092f65053afdfe561430bbf9
|
|
| BLAKE2b-256 |
6ca24ec707ec207f255ad4a5295aea100bd9beae627c13a1cd24683f7f9b0ffa
|
File details
Details for the file pytest_service-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pytest_service-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80e5d1cdc655f55b3be96aca2733b7a8ccd050549e2e63d3e1f49a3fad1c298d
|
|
| MD5 |
83a3925d53c4932f17f8797f4338853c
|
|
| BLAKE2b-256 |
9660a6b85660bef667a265a35925d90656fab85f2aa20a0bbf08a9ad715c99e8
|