Skip to main content

unittest enhancement

Project description

unitplus

Enhancement for unittest

Languate - Python PyPI - License PyPI PyPI - Downloads

Install

pip install unitplus

Simple Use

Document: https://python-yapi.readthedocs.io/en/latest/

中文文档: https://python-yapi.readthedocs.io/zh_CN/latest/

Register and Login

from python_yapi import YApi
yapi = YApi(base_url='http://localhost:3000')

username, email, password = 'Kevin', 'kevin@126.com', 'abc123'

yapi.register(username, email, password)  # return a dict
yapi.login( email, password) # return a dict

Simple Use

Write TestCase

from unitplus import TestCase, test


class TestDemo(TestCase):
    priority = 'p1'
    status = 'ready'
    owner = 'superhin'
    iteration = 'v0.1.0'
    tags = ['demo']

    @test(title='test demo a', priority='p2')
    def test_a(self):
        self.logger.info('a demo test case')

    @test(title='test ddt with data',data=['a', 'b', 'c'])
    def test_b(self, item):
        self.logger.info('item =', item)

Use TesPlan to run tests

from unitplus import TestPlan


class TestPlanDemo(TestPlan):
    # test names for suite
    tests = [
        'cases.testdemo',
    ]

    # filter tests by attributes
    filter = {
        'priorities': ['p0', 'p1'],
        'status': ['ready'],
        'tags': ['demo'],  # include tags
        'exclude_tags': ['post'],
        'exclude_names': [
            'cases.test_case3.TestA.test_get03',
            'cases.test_case4.TestA.test_get02',
        ]

    }


if __name__ == '__main__':
    # run suite , supporting multiple threads
    TestPlanDemo().run(verbosity=3)

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

unitplus-0.1.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

unitplus-0.1.0-py2.py3-none-any.whl (11.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file unitplus-0.1.0.tar.gz.

File metadata

  • Download URL: unitplus-0.1.0.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

Hashes for unitplus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 037fddc6ab60fb872249f60254cd9849658ad8fd560359228ee6f07fe326d3b7
MD5 3120240eb824e1213815bba9985d5a15
BLAKE2b-256 aecd83ba90e1904104e0ec6189388611083798d118dd128b35cad2b63033ca9a

See more details on using hashes here.

File details

Details for the file unitplus-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: unitplus-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for unitplus-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ec38cf4f3dcaac36a4974f17a2e9fc9d0402c0638b7705abcf7eb70089c993fe
MD5 d3451fb3b7ed44fdbe61f37bd32c1105
BLAKE2b-256 1f851bfc19997f7a31dcdc26698fb8d60ab4da52dd442875797bf8b1509e69b2

See more details on using hashes here.

Supported by

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