Skip to main content

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


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 details)

Uploaded Source

Built Distribution

pyfixtures-1.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pyfixtures-1.1.0.tar.gz.

File metadata

  • Download URL: pyfixtures-1.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.13 Linux/5.13.0-1025-azure

File hashes

Hashes for pyfixtures-1.1.0.tar.gz
Algorithm Hash digest
SHA256 58700c1abef58df4f520a2fc2099541971199e3fb707965f64b48adc442b9bba
MD5 69cd8a32e687aada3a7fb130753b2a10
BLAKE2b-256 927c66ff347ebce9eea833fc2c17a49e2614c90eff5e27e7a1662d060d7239a6

See more details on using hashes here.

File details

Details for the file pyfixtures-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyfixtures-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.13 Linux/5.13.0-1025-azure

File hashes

Hashes for pyfixtures-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bec76935532d9d98fa1c3f9f42175f915b0f8c8b12d3f08313a57c73c5116b0b
MD5 d7b5217cc283c85fbcf50d1572449826
BLAKE2b-256 50b7db6cf5e90a3c9ea6247f76617d7be9e21651ef93abc8bee2b82c85b3b073

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page