Skip to main content

display more node ininformation.

Project description

Welcome to pytest-informative-node

PyPi version Python version Build Status codecov

Display more node information.

Requirements

  • pytest >= 3.10.0
  • python >= 3.6

Not compatible with Python2.x

How to install

$ pip install pytest-informative-node

How to use

# pytest.ini
[pytest]
[informative_node_id]
enable    : true
delimiter : @

write docstring with leading delimiter you defined in pytest.ini [informative_node_id] section as node name.

class TestClass:
    """@you node id"""

def test_func():
    """@you node id"""

Test file and Test Package is also supported, just write docstring in the top of file and __init__.py respectively.

Options

Notice! [pytest]section must be included.
Notice! All options bellow must be under [informative_node_id] section in pytest.ini.

  • enable : [true / false] default is false.
  • delimiter : the delimiter to extract node_id in docstring, default is @.

Example

# Test file structure
scenario
|
|__functionality
    |__ __init__.py
    |   |# content of __init__.py
    |   |"""@LoginSection"""
    |   #\---------------------
    |
    |__ test_one.py
        |# content of __init__.py
        |   """@TestFile"""
        |   import pytest
        |   class TestClass:
        |       """@TestGroup"""
        |       
        |       @pytest.mark.parametrize('n', [1, 2], ids=['first', 'second'])
        |       def test_demo(self, n):
        |           """@DemoTest"""
        |           assert n == 1
        #\-----------------------
# Test report structure
✕LoginSection
|
|__ ✕TestFile
    |
    |__ ✕TestGroup
        |
        |__ ✕Demo Test
            |__ ✓first
            |__ ✕second

Notice: Duplicate custom node id under same test level is not allowed.
e.g.

def test_a():
    """@ login"""
def test_b():
    """@ login""" # <-----XXXXXX!

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, "pytest-informative-node" is free and open source software

Known Issue

  • If you test with Pycharm, you cannot navigate back to source test file from Test Runner tab.

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

File details

Details for the file pytest-informative-node-1.0.0.macosx-10.13-x86_64.tar.gz.

File metadata

  • Download URL: pytest-informative-node-1.0.0.macosx-10.13-x86_64.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for pytest-informative-node-1.0.0.macosx-10.13-x86_64.tar.gz
Algorithm Hash digest
SHA256 4cb7961902cdb0411ca00b21f388cff145d962709165ae6d36697c8a81fc2489
MD5 13021c560416dee3a098c9021899f309
BLAKE2b-256 05f35ae85a490a7f98e6140e1fd003802e40c7aa0c1560053e98fcb85cff1156

See more details on using hashes here.

Supported by

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