1.运行多个测试文件

pytest 会运行 test_ 开头 或者 _test 结尾的文件,在当前目录和子目录中

2. 一个类下的多个用例的运行, pytest会找到 test_ 开头的方法

import pytest

class TestClass(object):

	def test_one(self):
		x = "this"
		assert 'h' in x

	def test_two(self):
		x = "hello"
		assert hasattr(x, 'check')

运行一下,-q 是 在安静模式下运行

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐