Pytest extension for adding test options
Project description
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
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
fixtopt-xtofl-0.1.3.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for fixtopt_xtofl-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d38e19e30931573919843c25e582af59e26e269045e34b1c827aa15495675f6 |
|
MD5 | 150faa7d839143c9dc84b5ff1dac5bc2 |
|
BLAKE2b-256 | 44404e6c193f08013a8843d5f1dcbbf0e1a9a634cbbf27efe4d8cdaf3fabcd20 |