【发布时间】:2018-11-08 02:55:00
【问题描述】:
到目前为止,我们已经使用了 python unittest 框架。由于以下原因,现在我们想开始使用 pytest:
- jenkins 的 junit xml 报告
- 使用 pytest-xdist 并行执行
我们现有的测试框架包括几个测试类从单个类派生的案例,其中一个类是从unittest.TestCase 派生的,这样它们共享相同的setUp/tearDown。在 pytest 中,我相信它是用夹具完成的。
当我们尝试使用 pytest 运行我们的测试文件夹时,如果类直接派生自 unittest.TestCase,测试运行良好。但是,如果类是从我们的类派生的(如下所示)pytest crash with Abort(core dump)。
class l2_acl_base(unittest.TestCase):
def setUp(self):
self.device_name = '/dev/testdev'
self.create_system_setup()
self.create_packets()
def tearDown(self):
self.device.tearDown()
class acl_force_destination(l2_acl_base):
def test_acl_force_destination(self):
【问题讨论】:
-
请显示完整的错误堆栈跟踪。
-
发生在我身上,错误不是pythonic异常:
python [1] 1173852 IOT instruction (core dumped) pytest