Provide the pytest with the ability to collect use cases based on rules in text files
Project description
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.
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-choose-0.0.4.tar.gz
(16.7 kB
view hashes)
Built Distribution
Close
Hashes for pytest_choose-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ff683e8f32dacd2146a7adf5d02360c12fff290f76b1d625b6e63e93269b307 |
|
MD5 | 874f3073ea2649bbc23dd5647c9868f5 |
|
BLAKE2b-256 | fc67071cfbc4f1a2dfed3a4bd8d88fa9d9f42a2d919b0cda25a2ea2dff79e6b1 |