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 details)
Built Distribution
File details
Details for the file fixtopt-xtofl-0.1.4.tar.gz
.
File metadata
- Download URL: fixtopt-xtofl-0.1.4.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c99d29b4723c699c8a23d768985db870b8fe20639e35e21fc473befffb80513d |
|
MD5 | 2f9e1653a9ca89cdd6738fbd5979b5af |
|
BLAKE2b-256 | f3bb7f80b30919fef276d0dbdadbace981ebc761444104c8d2d800115b42f93b |
File details
Details for the file fixtopt_xtofl-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: fixtopt_xtofl-0.1.4-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42a675a657b5ea9c3dbd3b8fbd2ff1f2b209bf199db02e05cbb443bd42391fb |
|
MD5 | d173437e2f9c3a8ff209c9dd886dae98 |
|
BLAKE2b-256 | c47abaf4f8ede6ea703c1e1d652e74fa12580af552d15d4e5e531a54e802f603 |