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.5.tar.gz
(16.8 kB
view details)
Built Distribution
File details
Details for the file pytest-choose-0.0.5.tar.gz
.
File metadata
- Download URL: pytest-choose-0.0.5.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4578043743cf547d7693625fe5c7fc1ce647a4964c6e0d2e58c97fdd12e07b5 |
|
MD5 | 4cbea052cf067b6dd4c76c9adaf4559d |
|
BLAKE2b-256 | 4998aff76da79df0fbacea0c82d0ca06a4d053d0f8fa0c54fd9d563f9ffcaa7e |
File details
Details for the file pytest_choose-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: pytest_choose-0.0.5-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebc3d678c0d1cb1c4734d30e0e9866c0eeb7f39166e15bb8f2d7a02a5029fe4f |
|
MD5 | 84eec997a4acb16947eec81636c970c1 |
|
BLAKE2b-256 | 198ff4f6477ca436457bf8f5513f8bd677a58c91d3cc25110453a0a5bc783ada |