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

网站建设仟首选金手指域名查询地址

网站建设仟首选金手指,域名查询地址,北京网站设计课程,西安工程造价信息网默认情况下#xff0c;pytest 使用pytest.Package来收集包含 __init__.py 文件的目录#xff0c;使用 pytest.Dir来收集其他目录。如果你想要自定义目录的收集方式#xff0c;你可以编写自己的pytest.Directory 收集器#xff0c;并使用 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(encodingutf-8)) ihook self.ihook for file in manifest[files]: yield from ihook.pytest_collect_file( file_pathself.path / file, parentself ) pytest.hookimpl def pytest_collect_directory(path, parent): # 对于包含manifest.json文件的目录使用我们的自定义收集器。 if path.joinpath(manifest.json).is_file(): return ManifestDirectory.from_parent(parentparent, pathpath) # 否则回退到标准行为。 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 $ pytesttest 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-onlytest 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 itemsDir customdirectoryManifestDirectory testsModule test_first.pyFunction test_1Module test_second.pyFunction test_2 2 tests collected in 0.12s
http://www.w-s-a.com/news/323257/

相关文章:

  • 自助网站建设系统软件自己免费建设网站
  • 百度微建站access如何与网站连接数据库
  • ppt素材免费网站网站正能量晚上免费软件
  • 个人淘宝客网站如何备案搭建一个平台要多少钱
  • nginx 网站建设淘客网站怎么做首页
  • 网站制作的基本步骤是手机网站建设 新闻
  • 水墨 网站源码工装
  • 任丘网站建设服务网站 建设原则
  • 长沙做一个网站要多少钱网站底部备案代码
  • wordpress构建自定义设置页面seo培训学什么
  • 延安有哪些做网站的公司如何建设网站?
  • 网站建设者属于广告经营者吗网站管理程序
  • 网站内容优化方法深圳市宝安区怎么样
  • 视频网站开发视频公司网站制作多少钱
  • 单页简洁手机网站模板购物软件
  • 素材网站官网低价网站建设费用预算
  • 苏州网站设计kgwl个人网站有什么外国广告做
  • 浙江省网站建设报价简单网站开发工具
  • 物流网站的建设wordpress电视直播插件下载
  • 简述网站开发流程青岛做网站建设价格低
  • 网站开发的业务需求分析杭州推广公司
  • 网站建设技术实现难点app开发需要哪些软件
  • 响水建设局网站做网站需要会哪些知识
  • 企业制作企业网站个人网站可以做百度竞价
  • 做网站找投资人wordpress 5 主题教程
  • 做国外网站汇款用途是什么wordpress图片主题晨曦
  • 网站设计跟网站开发区别为什么网站需要维护
  • m 的手机网站怎么做网络推广方式和方法
  • wordpress图片自动轮播插件seo门户网站建设
  • 制作商业网站传奇网页游戏排名