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 details)
Built Distribution
File details
Details for the file pyfixtures-1.0.0.tar.gz
.
File metadata
- Download URL: pyfixtures-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.13 Linux/5.13.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 448b32e584316c3fb5b90e72ed69b12ebd8dbaf8abf7f7dc757070ac07575e97 |
|
MD5 | 1f2ead86f1fea573df4eb8e303e810c6 |
|
BLAKE2b-256 | 2dbcac7a40f118261a1447d47d9bd8e2c4b2fb2cad7ca495bb5a955979dce1c1 |
File details
Details for the file pyfixtures-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyfixtures-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.8.13 Linux/5.13.0-1023-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6deadee0c105cd425539a17a98a17b59367c5179696a1e336159dd30b2fb58ee |
|
MD5 | 30b23d3e6a65af376fec825338b0e373 |
|
BLAKE2b-256 | 9db14e17fefb0729c2903f5831bcccb7faeb6fdade5b8453e46f90f4ddfbf3c8 |