Skip to main content

Pytest extension for adding test options

Project description


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, inside your test directory.

Add the options:

from fixtopt import Option, register

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

            help="the message file"),

            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( == receiver

And you can run your tests with the declared options:

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

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

fixtopt-xtofl-0.1.4.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

fixtopt_xtofl-0.1.4-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

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