当前位置: 首页 > news >正文

有什么可靠网站做建材代理的吗常德seo公司

有什么可靠网站做建材代理的吗,常德seo公司,建筑人才网平台,抖音小程序搭建默认情况下,pytest 使用pytest.Package来收集包含 __init__.py 文件的目录,使用 pytest.Dir来收集其他目录。如果你想要自定义目录的收集方式,你可以编写自己的pytest.Directory 收集器,并使用 pytest_collect_directory钩子来连接…

默认情况下,pytest 使用pytest.Package来收集包含 __init__.py 文件的目录,使用 pytest.Dir来收集其他目录。如果你想要自定义目录的收集方式,你可以编写自己的pytest.Directory 收集器,并使用 pytest_collect_directory钩子来连接它。

对于目录清单文件的一个基本示例

假设你想要自定义每个目录的收集方式。以下是一个conftest.py插件的示例,它允许目录包含一个manifest.json文件,该文件定义了该目录的收集方式。在这个示例中,仅支持一个简单的文件列表,但你可以想象添加其他键,如排除项和通配符。

from __future__ import annotations  import json  import pytest  class ManifestDirectory(pytest.Directory):  def collect(self):  # pytest的标准行为是遍历所有`test_*.py`文件,并对每个文件调用`pytest_collect_file`。  # 这个收集器改为读取`manifest.json`文件,并且仅对其中定义的文件调用`pytest_collect_file`。  manifest_path = self.path / "manifest.json"  manifest = json.loads(manifest_path.read_text(encoding="utf-8"))  ihook = self.ihook  for file in manifest["files"]:  yield from ihook.pytest_collect_file(  file_path=self.path / file, parent=self  )  @pytest.hookimpl  
def pytest_collect_directory(path, parent):  # 对于包含`manifest.json`文件的目录,使用我们的自定义收集器。  if path.joinpath("manifest.json").is_file():  return ManifestDirectory.from_parent(parent=parent, path=path)  # 否则,回退到标准行为。  return None

你可以创建一个 manifest.json 文件和一些测试文件:

{"files": ["test_first.py","test_second.py"]
}
# content of test_first.py
from __future__ import annotationsdef test_1():pass
# content of test_second.py
from __future__ import annotationsdef test_2():pass
# content of test_third.py
from __future__ import annotationsdef test_3():pass

现在你可以执行测试规范了:

customdirectory $ pytest
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
rootdir: /home/sweet/project/customdirectory
configfile: pytest.ini
collected 2 itemstests/test_first.py .                                                [ 50%]
tests/test_second.py .                                               [100%]============================ 2 passed in 0.12s =============================

请注意,test_three.py 没有被执行,因为它没有在清单中列出。

你可以验证你的自定义收集器是否出现在收集树中:

customdirectory $ pytest --collect-only
=========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y
rootdir: /home/sweet/project/customdirectory
configfile: pytest.ini
collected 2 items<Dir customdirectory><ManifestDirectory tests><Module test_first.py><Function test_1><Module test_second.py><Function test_2>======================== 2 tests collected in 0.12s ========================

http://www.dinnco.com/news/71735.html

相关文章:

  • 网站建设的平面设计磁力搜索器 磁力猫
  • 网站建设中山优化上海百网优seo优化公司
  • 任县网站建设设计seo挖关键词
  • 基于asp.net电子商务网站开发实践中的关键技术和应用重庆公司seo
  • 富阳设计网站电子商务主要学什么内容
  • 河北省建设工程安全生产监督管理网站站长之家收录查询
  • 电脑做网站服务器需要什么软件短视频seo推广
  • 高中教学网站最近爆发什么病毒感染
  • php动态网站开发期末考试东莞整站优化
  • 宁波网站推广厂家电话做seo的公司
  • .net 网站开发权限设计销售清单软件永久免费版
  • 做网站好比做房子爬虫搜索引擎
  • 成都网站建设网络公司网站建设营销推广
  • 字体中国设计网惠州seo外包公司
  • 广州天河区有什么好玩的地方优化器
  • 市场营销方案500字seo搜外
  • 怎么做公众号网站石家庄seo排名公司
  • 注册软件开发公司需要什么条件东莞市网络seo推广服务机构
  • 网页设计介绍说明太原seo建站
  • ppt做会动彩字网站360指数查询
  • 域名网站备案管理系统全网关键词云怎么查
  • 通州网站建设电话seo百科
  • 做英语quiz的网站网站百度seo关键词优化
  • 广东地区建网站的公司抖音广告代运营
  • cod单页建站工具得物app的网络营销分析论文
  • 网站怎么做404页面的跳转樱桃磁力bt天堂
  • 万州网站建设多少钱提供seo服务
  • 做自己的网站的好处网站换友链平台
  • 网站制作公司北京网站建设公司哪家好百度快速优化推广
  • 微信营销软件网站建设百度数据中心