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.1.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for pytest_service-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e564708d56ff2598bf64bbbe81932f9e061d90a8a1dfb96177a7a2f0793800d5 |
|
MD5 | fd201fe9e26df2ad1292869ae3b346be |
|
BLAKE2b-256 | dfa1847579767384eca4a52991be07cb5c12767741a90af12713ef828b2e4ee0 |