pytest-custom-nodeid: pytest plugin
Support custom grouping. {group name} or {testfile::class}
Rename testcases name and testcases nodeid, support allure report.
The loadscope load policy based on pytest-xdist is used.
Change testcases nodeid and testcases name encoding to UTF-8 and unicode escape
Because when ‘pytest xdist’ uses’ - x ‘(stops when it fails), if any use case fails, the whole concurrency will stop running
The skip function is supported. The selected group name will skip all the remaining use cases of the group after the first use case of the group fails to run
This function is particularly useful in scenario testing and other test sets where use cases depend on each other,
to avoid failure of previous use cases and unnecessary execution of subsequent use cases
- Format:
name: ids
nodeid: group_name::ids
install
pip install pytest-custom-nodeid
Usage
command line:pytest –rename={on:off} –skip=group_name –skip-json=absolute_path
options:
–rename It is used to open the plug-in, rename the marked use cases, code the unmarked use cases only, and close “off” by default
–skip If it fails, the subsequent use case will be skipped. The tag name is needed here. example: if the tag in IDS is ‘{login}’, the skip tag is ‘–skip=login`
–skip-json When there are too many tags to be marked, it can be stored in a JSON file. Here you need to enter the absolute address, which can be used with ‘skip’. The two tags will be combined
tip:
It supports running with pytest xdist, and can be concurrent with class according to loadscope policy
Use {…} as a marker custom grouping.
Support “{ filename::classname }” format for multi-level settings
Skip and skip-json are case-sensitive
Do not use ‘-x’ in pytest-xdist. If the use case fails, the rest of the use cases will stop running
Demo
import pytest
@pytest.mark.parametrize("group",
["world", "hello", "hello", "hello", "world", "world"],
ids=["group_4{group_1}", "group_5{group_2}", "group_6{file::class}",
"group_7{group_1}", "group_8{group_2}", "group_9{file::class}"])
def test_05(group):
a = "hello"
assert a == group
cmd line: pytest –rename=on –skip=group_1 –skip=group_2 –skip=file::class -n=auto –dist=loadscope
Skip marks the group to which the preceding use case fails, causing subsequent use cases to skip
Using the loadscope load policy, because there are three groups, it will be divided into three groups to run concurrently
nodeid will be renamed to
group_1::group_4
group_2::group_5
group_1::group_7
group_2::group_8
log
v0.2
Add label alias, fail skip function
v0.3
Add relative address support for skip-json
Metadata
Release files for pytest-custom-nodeid 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest-custom-nodeid-0.3.tar.gz | 4.4 kB | Without provenance | Details for pytest-custom-nodeid-0.3.tar.gz |
Release files / pytest-custom-nodeid-0.3.tar.gz
| Download URL | pytest-custom-nodeid-0.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f96c8b5086432efd64827162d53c5382ab2fa1f5d93da296482d5bcff433c24
|
|
BLAKE2b-256 checksum How to use checksums |
c2d65b3570774b7d9c65f5858b1b0c5bb709e4f2a672b6aa7f93e00febaa6c4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.0
|
Security for pytest-custom-nodeid 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.