Pytest style fixtures outside of Pytest.
Project description
Fixtures
Pytest style fixtures outside of Pytest.
import asyncio
from pathlib import Path
from py_fixtures import fixture, FixtureScope
@fixture
def tmpdir() -> Path:
path = Path("temp")
path.mkdir()
try:
yield path
finally:
path.unlink()
def mk_temp_files(tmpdir: Path):
tmp_file = tmpdir/"tempfile.txt"
tmp_file.touch()
async def main():
async with FixtureScope() as scope:
operation = await scope.bind(mk_temp_files)
await operation()
asyncio.run(main())
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
pyfixtures-1.0.0.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for pyfixtures-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6deadee0c105cd425539a17a98a17b59367c5179696a1e336159dd30b2fb58ee |
|
MD5 | 30b23d3e6a65af376fec825338b0e373 |
|
BLAKE2b-256 | 9db14e17fefb0729c2903f5831bcccb7faeb6fdade5b8453e46f90f4ddfbf3c8 |