其他分享
首页 > 其他分享> > 【pytest】plugins插件开发

【pytest】plugins插件开发

作者:互联网

import pytest

def pytest_addoption(parser):
    parser.addoption(
        "--change",
        action="store",
        default="off",
        help="'Default 'off' for change, option: on or off"
    )


def pytest_report_teststatus(report, config):
    '''turn . into √,turn F into x, turn E into 0'''
    if config.getoption("--change") == "on":
        if report.when == 'call' and report.failed:
            return (report.outcome, 'x', 'failed')
        if report.when == 'call' and report.passed:
            return (report.outcome, 'Y', 'passed')
from setuptools import setup

setup(
    name='pytest-change-report',
    url='https://github.com/yoyoketang/pytest-change-report',
    version='1.0',
    author="xwl",
    author_email='XXXXX@qq.com',
    description='turn . into Y,turn F into x',
    long_description='print result on terminal turn . into Y,turn F into x using hook',
    classifiers=[
        'Framework :: Pytest',
        'Programming Language :: Python',
        'Topic :: Software Development :: Testing',
        'Programming Language :: Python :: 3.6',
    ],
    license='proprietary',
    py_modules=['pytest_change_report'],
    keywords=[
        'pytest', 'py.test', 'pytest-change-report',
    ],

    install_requires=[
        'pytest'
    ],
    entry_points={
        'pytest11': [
            'change-report = pytest_change_report',
        ]
    }
)

标签:插件,py,conftest,pytest,plugins,report,change
来源: https://www.cnblogs.com/xwltest/p/16629446.html