首页 文章

Pytest运行unittest退出核心转储

提问于
浏览
0

到目前为止,我们已经使用了python unittest框架 . 现在我们想开始使用pytest,原因如下:

jenkins的

  • junit xml报告

  • 使用pytest-xdist并行执行

我们现有的测试框架包括几个测试类派生自单个类的情况,这些测试类是从 unittest.TestCase 派生的,这样他们共享相同的 setUp/tearDown . 在pytest中我相信它是用夹具完成的 .

当我们尝试使用pytest运行我们的tests文件夹时,如果类直接派生自 unittest.TestCase 测试运行正常 . 但是,如果类派生自我们的类(如下所示),则使用Abort(核心转储)进行pytest崩溃 .

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):

1 回答

  • 0

    我能够追溯到ENV问题,问题与pytest无关考虑案例关闭 .

相关问题