Pytest style fixtures outside of Pytest.
Project description
PyFixtures
Pytest style fixtures outside of Pytest.
import asyncio
from pathlib import Path
from pyfixtures 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.1.0.tar.gz
(8.1 kB
view hashes)
Built Distribution
Close
Hashes for pyfixtures-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bec76935532d9d98fa1c3f9f42175f915b0f8c8b12d3f08313a57c73c5116b0b |
|
MD5 | d7b5217cc283c85fbcf50d1572449826 |
|
BLAKE2b-256 | 50b7db6cf5e90a3c9ea6247f76617d7be9e21651ef93abc8bee2b82c85b3b073 |