pytest-bdd 项目使用教程

pytest-bdd 项目使用教程

pytest-bddBDD library for the py.test runner项目地址:https://gitcode.com/gh_mirrors/py/pytest-bdd

1. 项目的目录结构及介绍

pytest-bdd 项目的目录结构如下:

pytest-bdd/
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── docs/
│   ├── conf.py
│   ├── index.rst
│   └── ...
├── pytest_bdd/
│   ├── __init__.py
│   ├── model.py
│   ├── parser.py
│   ├── scenario.py
│   ├── step_registry.py
│   └── ...
├── setup.cfg
├── setup.py
└── tests/
    ├── conftest.py
    ├── test_example.py
    └── ...

主要目录和文件介绍:

  • CHANGELOG.md: 记录项目的版本变更历史。
  • CONTRIBUTING.md: 指导如何为项目贡献代码。
  • LICENSE: 项目的开源许可证。
  • README.md: 项目的基本介绍和使用说明。
  • docs/: 包含项目的文档文件,使用 Sphinx 生成。
  • pytest_bdd/: 核心代码目录,包含项目的所有 Python 模块。
  • setup.cfg: 项目的配置文件,用于打包和分发。
  • setup.py: 项目的安装脚本。
  • tests/: 包含项目的测试用例。

2. 项目的启动文件介绍

pytest-bdd 项目的启动文件主要是 setup.pypytest_bdd/__init__.py

setup.py

setup.py 是 Python 项目的标准安装脚本,用于安装和分发项目。它通常包含项目的元数据(如名称、版本、依赖等)和安装指令。

from setuptools import setup, find_packages

setup(
    name='pytest-bdd',
    version='4.0.2',
    description='BDD for pytest',
    long_description=open('README.md').read(),
    long_description_content_type='text/markdown',
    author='Pytest-BDD Developers',
    url='https://github.com/pytest-dev/pytest-bdd',
    packages=find_packages(exclude=['tests']),
    install_requires=[
        'pytest>=3.0.0',
        'six',
    ],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Framework :: Pytest',
        'Intended Audience :: Developers',
        'Topic :: Software Development :: Testing',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
        'Programming Language :: Python :: 3.8',
        'Programming Language :: Python :: 3.9',
        'Programming Language :: Python :: Implementation :: CPython',
        'Programming Language :: Python :: Implementation :: PyPy',
        'Operating System :: OS Independent',
        'License :: OSI Approved :: MIT License',
    ],
    entry_points={
        'pytest11': [
            'bdd = pytest_bdd.plugin',
        ],
    },
)

pytest_bdd/init.py

pytest_bdd/__init__.py 是 pytest-bdd 包的初始化文件,定义了包的版本和一些基本配置。

__version__ = '4.0.2'

3. 项目的配置文件介绍

pytest-bdd 项目的配置文件主要是 setup.cfg

setup.cfg

setup.cfg 是 Python 项目的配置文件,用于指定打包和分发的配置选项。它包含了一些常用的配置,如测试、代码风格检查等。

[metadata]
name = pytest-bdd
version = attr: pytest_bdd.__version__
description = BDD for pytest
long_description = file: README.md
long_description_content_type = text/markdown
author = Pytest-BDD Developers
url = https://github.com/pytest-dev/pytest-bdd
license = MIT

[options]
packages = find:
install_requires =
    pytest>=3.0.0
    six

[options.extras_require]
docs =

pytest-bddBDD library for the py.test runner项目地址:https://gitcode.com/gh_mirrors/py/pytest-bdd

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王海高Eudora

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值