Skip to main content

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.

Release files for pytest-typhoon-config 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-typhoon-config 1.0.0
File Size Uploaded
pytest-typhoon-config-1.0.0.tar.gz 4.1 kB Details

Release files / pytest-typhoon-config-1.0.0.tar.gz

Download URL pytest-typhoon-config-1.0.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3b9657018368f6044080c6fb9d708d6d303a06451a48c3c23415d36ce02e9d97
BLAKE2b-256 checksum
How to use checksums
823d6fb0d763d78bba9abbe35f3bc71bb57fe2013e37895d8e832d31dd6488c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page