A simple plugin to detect missed pytest tags and markers"
Project description
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.
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-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 –all-skipped-fail
pytest –assert-steps
pytest –bdd-format
Examples of ‘pytest’ run with provided options:
$ pytest tests –staging –assert-steps
======================= 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
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
Built Distribution
Hashes for pytest-markers-presence-0.12.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d7b6bbf78ade5a0b97a9c77695d03005c0606c48cb28458e2f2cd64fa4abd0 |
|
MD5 | 2ca3ea837d378f5ba4a8a8a88e894346 |
|
BLAKE2b-256 | 5427191168dbdb53fd04630c125fe7c16eaaffe25c0988b05b19aee7dacde303 |
Hashes for pytest_markers_presence-0.12.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 654710f052a3977d70651fe1d48390dfae3f1be2c348d94a8efb84600d8f23cb |
|
MD5 | 14c315e7ca9968d57c3bdfd8ef3144ca |
|
BLAKE2b-256 | 71408742fde2076dab837bedef39354bfe710e7d76dfe0fdbc619494b8419143 |