如何在pytest下测试单个文件 [英] How to test single file under pytest

查看:59
本文介绍了如何在pytest下测试单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在pytest中测试单个文件?我只能在文档中找到忽略选项,而没有仅测试此文件"选项.

How do you test a single file in pytest? I could only find ignore options and no "test this file only" option in the docs.

最好在命令行而不是 setup.cfg 上工作,因为我想在 ide 中运行不同的文件测试.整个套件耗时太长.

Preferably this would work on the command line instead of setup.cfg, as I would like to run different file tests in the ide. The entire suite takes too long.

推荐答案

只需使用文件路径运行 pytest

simply run pytest with the path to the file

类似的东西

pytest 测试/unit/some_test_file.py

这篇关于如何在pytest下测试单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆