pytest-choose
English | 简体中文
Provide the pytest with the ability to collect use cases based on rules in text files
Install
pip install pytest-choose
Example
Create Test Files:
# test_demo.py
class TestDemo:
def test_demo_1(self):
print(1)
def test_demo_2(self):
print(2)
def test_demo_3():
print(3)
def test_demo_4():
print(4)
def test_demo_5():
print(5)
def test_demo_6():
print(6)
def test_demo_7():
print(7)
Create the choose.json file:
// choose.json
{
"class": [
"TestDemo"
],
"function": [
"test_demo_2",
"test_demo_3",
"test_demo_4",
"test_demo_5"
]
}
Run tests:
pytest --fc="on" --fc-path="./choose.json" --fc-coding="utf-8"
Running results:
======================= test session starts =======================
platform win32 -- Python 3.9.6, pytest-7.4.2, pluggy-1.3.0
rootdir: pytest-choose
plugins: choose-0.0.1
collecting ...
[pytest-choose] Cases list: ./choose.json
[pytest-choose] Filter 2 cases and collect 5 cases
collected 7 items
cases\test_choose.py ..... [100%]
======================== 5 passed in 0.04s ========================
Parameter Description
| Parameter | Description |
|---|---|
| --fc | Default 'off' for file choose, option: 'on' or 'off' |
| --fc-path | File Path, default './choose.json' |
| --fc-coding | File encoding, default 'utf-8' |
License
pytest-choose is licensed under GPLv3.
Copyright © 2023 by Azusa.
Metadata
Release files for pytest-choose 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-choose-0.0.7.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_choose-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.2 kB
Release files / pytest-choose-0.0.7.tar.gz
| Download URL | pytest-choose-0.0.7.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b65ab5b028286e9d4d3b0e727d11f2ad19202ad0043e24f7f8323aee05e990f0
|
|
BLAKE2b-256 checksum How to use checksums |
ca741e7836e2bbbe951a5782289f151d5646e8c0faf89bf8d071791c0979d6c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Release files / pytest_choose-0.0.7-py3-none-any.whl
| Download URL | pytest_choose-0.0.7-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7279120f20b06f85f03335f23c3f7894b30dc3003db7aad62196110536bfae24
|
|
BLAKE2b-256 checksum How to use checksums |
0da3ce189475d1bd224806401c61b8f0355dd70d1a863ee4821f13a2f0ac0420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|