Skip to main content

Pytest extension for adding test options

Project description

fixtopt

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

Add the options like this:

from fixtopt import Option, register

def pytest_options(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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fixtopt-xtofl, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size fixtopt-xtofl-0.1.2.linux-x86_64.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View hashes
Filename, size fixtopt_xtofl-0.1.2-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page