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.4.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for fixtopt_xtofl-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42a675a657b5ea9c3dbd3b8fbd2ff1f2b209bf199db02e05cbb443bd42391fb |
|
MD5 | d173437e2f9c3a8ff209c9dd886dae98 |
|
BLAKE2b-256 | c47abaf4f8ede6ea703c1e1d652e74fa12580af552d15d4e5e531a54e802f603 |