Skip to main content

fixtopt

Extend your pytests with options that can be accessed as test fixtures.

Pytest allows declaring command line options for your tests. You specify this in a test hook defined in e.g. a file called conftest.py, inside your test directory.

Add the options:

# conftest.py
from fixtopt import Option, register

def pytest_addoption(parser):
    register(globals(), parser, (

        Option(
            name="message",
            default="message.txt",
            help="the message file"),

        Option(
            name="receiver",
            default="World",
            help="the receiver"),

    ))

Import the options in your tests like you would import a fixture:

import my_mailclient

def test_a_person_receives_a_message(message, receiver):
    with open(message) as f:
        assert my_mailclient.receiver(f.read()) == receiver

And you can run your tests with the declared options:

pytest . --message /path/to/messagefile --receiver mrs.X

Metadata

Release files for fixtopt-xtofl 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fixtopt-xtofl 0.1.4
File Size Uploaded
fixtopt-xtofl-0.1.4.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fixtopt-xtofl 0.1.4
File Interpreter ABI Platform
fixtopt_xtofl-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / fixtopt-xtofl-0.1.4.tar.gz

Download URL fixtopt-xtofl-0.1.4.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c99d29b4723c699c8a23d768985db870b8fe20639e35e21fc473befffb80513d
BLAKE2b-256 checksum
How to use checksums
f3bb7f80b30919fef276d0dbdadbace981ebc761444104c8d2d800115b42f93b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / fixtopt_xtofl-0.1.4-py3-none-any.whl

Download URL fixtopt_xtofl-0.1.4-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d42a675a657b5ea9c3dbd3b8fbd2ff1f2b209bf199db02e05cbb443bd42391fb
BLAKE2b-256 checksum
How to use checksums
c47abaf4f8ede6ea703c1e1d652e74fa12580af552d15d4e5e531a54e802f603
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

1 release file

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page