Skip to main content

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 1 cases and collect 6 cases
collected 7 items

cases\test_choose.py ......                        [100%] 
======================== 6 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.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

pytest_choose-0.0.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file pytest-choose-0.0.1.tar.gz.

File metadata

  • Download URL: pytest-choose-0.0.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pytest-choose-0.0.1.tar.gz
Algorithm Hash digest
SHA256 049af457a440ebab776b8209d9570f04945cc2b3f639df7a9f2b76e7aee66593
MD5 a0daa79f65dd87bffac9a7374d8e875b
BLAKE2b-256 f7d8d8ae40c9e6db364dd0a1b69ab5183f6f6c5a65688be2bd214f13f8b3ceff

See more details on using hashes here.

File details

Details for the file pytest_choose-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_choose-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pytest_choose-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 411caad3fa6199f09ca6e2c5b0e87a0c298383cfc6a2eca997ce436011795b8f
MD5 bf439cdd143089a85d28b6ab67b6476f
BLAKE2b-256 c9c46e4b014c747b9b55683471da1beeb9bbd76af8a668d947885fdefa657a10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page