A Typhoon HIL plugin that facilitates test parameter configuration at runtime
Project description
pytest-typhoon-config
A pytest plugin that facilitates test parameter configuration at runtime
Features
- specify test parameters in a python module, just like any other
- choose which module to use at runtime
This way you can define different parameter sets for the same test suite and choose them at runtime.
Requirements
- pytest 6+
Installation
You can install pytest-typhoon-config
via pip
:
pip install pytest-typhoon-config
Usage
Create a test parameter definition file as a Python module, such as this:
# myparams.py
import numpy as np
a_list = [277.0, 278.0]
a_numpy_range = np.arange(58, 63, 0.2)
even_values = [v for v in range(20) if v % 2 == 0]
class StayConnected:
some_list = [22, 45, 85, 95]
some_param = 0.95
All module attributes will be injected at runtime in
tytest.config.runtime_settings.Config
class. They will be available as
class-level attributes of Config
. That means you can use them
like this:
from tytest.runtime_settings import Config as C
@python.mark.parametrize('param1', C.even_values)
def test_something(param1):
pass
In this example even_values
variable will be initialized in myparams.py
module, and then injected into Config
class. It is available in all test
code as Config.even_values
.
This way you can create different python modules with the same variables, having different values, and then choose which module to use when invoking pytest. For example:
pytest --runconfig=myparams.py
The path of this file is evaluated at runtime.
Contributions
Contributions are very welcome. Tests can be run with tox
, please ensure
the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the MIT license, pytest-typhoon-config
is
free and open source software.
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
Hashes for pytest-typhoon-config-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b9657018368f6044080c6fb9d708d6d303a06451a48c3c23415d36ce02e9d97 |
|
MD5 | 5042672beef3282b890f90e08a9c0003 |
|
BLAKE2b-256 | 823d6fb0d763d78bba9abbe35f3bc71bb57fe2013e37895d8e832d31dd6488c9 |