Skip to main content

A plugin that will filter pytest's test collection using a json file. It will read a json file provided with a --json argument in pytest command line (or in pytest.ini), search the markers key and automatically add -m option to the command line for filtering out the tests marked with disabled markers.

Project description

PyPI version Python versions See Build Status on GitHub Actions

A plugin that will filter pytest’s test collection using a json file. It will read a json file provided with a –json argument in pytest command line (or in pytest.ini), search the ‘markers’ key and automatically add -m option to the command line for filtering out the tests marked with disabled markers.


This pytest plugin was generated with Cookiecutter along with @hackebrot’s cookiecutter-pytest-plugin template.

Requirements

  • json >= 2.0.9

Installation

You can install “pytest-himark” via pip from PyPI:

$ pip install pytest-himark

Usage

After installing this plugin, pytest will automatically load it when launching tests. You will simply need to add the –json option to the command line with the path to the json containing the markers you want to enable. Alternatively, you can add the –json option and the path in the pytest.ini directly, in the addopts variable.

Example:
  • pytest.ini:

addopts = --json=path/to/my/config.json
  • config.json:

{
    "markers": {
        "my_marker1": true,
        "my_marker2": true,
        "my_marker3": false,
        "my_marker4": false
    }
}

Launching pytest now will automatically add he following to the command line:

>> pytest -m "(my_marker1 or my_marker2) and not (my_marker3 or my_marker4)"

Contributing

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-himark” is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_himark-0.1.3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

pytest_himark-0.1.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest_himark-0.1.3.tar.gz.

File metadata

  • Download URL: pytest_himark-0.1.3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for pytest_himark-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ebd2998891603e2f87bfcae123b210b28e95c00264b811075e34c89b057e2413
MD5 077d8e033f648029ecaca8a3e43e2a7b
BLAKE2b-256 5ad617f43bfde7fba66967effaa03dd8644cd4eb62dc357bb8ee8557e13c600f

See more details on using hashes here.

File details

Details for the file pytest_himark-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_himark-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d9318fcc0ffc4a5befbf4cbe06e61b245ff76358af2c14f7658676174a7be0
MD5 5967476af369582ff65a23b7b0461626
BLAKE2b-256 573c6ab912e6fe8c51801c4d1e350cdfcba7439e9c7d93be4b65b5ec838deceb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page