Skip to main content

A simple plugin to detect missed pytest tags and markers"

Project description

PyPI version Python versions See Build Status on Travis CI See Build Status on AppVeyor

A simple plugin for easy staging your Python3 project’s structure of PyTest tests. Make the repository with your tests structured with Allure ideology.

Features

  • Dynamical tests marking based on ‘tests’ subfolders

  • List not classified functions

  • List missed Allure BDD tags for test classes and functions (exclude fixtures and other incompatible objects)

  • Assertions rewriting with Allure steps including attachments for complex objects:
    • Pydantic BaseModels

    • dictionaries

    • lists

    • long strings.

  • Setting Allure titles for BDD tests based on ‘Scenario’ information

  • Collecting of task tracker tickets with specified keyword

  • Enable setting of fail exitcode when all session tests were skipped

Installation

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

$ pip install pytest-markers-presence

Usage

The –staging option is compatible with simple pytest run loop and could be used for dynamical tests marking. The –staging-warnings option just enables warnings for –staging option.

The –assert-steps option is compatible with simple pytest run loop and could be used for assertions rewriting with Allure steps.

The –bdd-titles option is compatible with simple pytest run loop and could be used for setting Allure titles for BDD tests based on ‘Scenario’ information.

The –bdd-format option will not run your tests and it’s also sensible for errors in the pytest collection step. If you are using as part of you CI process the recommended way is to run it after the default test run.

The –all-skipped-fail option is compatible is simple pytest run loop and could be used for enabling of fail exitcode setting when all session tests were skipped.

For example:

script:
  • pytest

  • pytest –staging –bdd-titles –all-skipped-fail

  • pytest –assert-steps

  • pytest –bdd-format

Examples of ‘pytest’ run with provided options:

$ pytest tests –staging –assert-steps –bdd-titles

======================= test session starts =======================

(hidden for brevity)

==================== 1 passed in 0.51 seconds =====================

$ pytest –bdd-format

======================= test session starts =======================

(hidden for brevity)

You should create test class(es) for your test function(s): Test function: ‘test_function’, location: /path/to/test.py

You should set BDD tag @allure.feature’ for your test class(es): Test class: ‘TestClass’, location: /path/to/file.py

You should set BDD tag @allure.story’ for your test function(s): Test function: ‘test_case’, location: /path/to/file.py

================== no tests ran in 0.00 seconds ===================

$ pytest –all-skipped-fail

======================= test session starts =======================

(hidden for brevity)

test_fail_on_all_skipped_when_skip.py::test_case SKIPPED [100%]

Changed exitcode to FAILED because all tests were skipped.

======================== 1 skipped in 0.01s =======================

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

Issues

If you encounter any problems, please pytest-markers-presence 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-markers-presence-0.11.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_markers_presence-0.11.0-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest-markers-presence-0.11.0.tar.gz.

File metadata

  • Download URL: pytest-markers-presence-0.11.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for pytest-markers-presence-0.11.0.tar.gz
Algorithm Hash digest
SHA256 48b7c66fda9e3f8bb7ac8cb905f3054df93a937759f3bb8470a26b31b5f5a444
MD5 6874a1487ed3c20014a4d8aa4b0c5e05
BLAKE2b-256 a49509bee1c54d16dae894cc3eb99f885cbcf1d142faa6ded5f86f9558077917

See more details on using hashes here.

File details

Details for the file pytest_markers_presence-0.11.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_markers_presence-0.11.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for pytest_markers_presence-0.11.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 50fbe585c09072bbb62c4fd41eccee2e035ab88984fe6dc9bdfba33baea33331
MD5 31275a5882f4699b66fdb49f171e2b12
BLAKE2b-256 d73744ca298e598d5af99fe1d6d33e220b2b30f0a2aa48ebf9a3d56a27773db7

See more details on using hashes here.

Supported by

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