我用元类生成的python +硒进行了测试
class TestMeta(type):
def __new__(mcs, name, bases, dct):
def gen_test(site):
def test(self):
# test actions
return test
for site in all_sites:
test_name = "test_%s" % site[8:-4]
dct[test_name] = gen_test(site)
return type.__new__(mcs, name, bases, dct)
class Test(Environment, metaclass=TestMeta):
__metaclass__ = TestMeta
if __name__ == '__main__':
unittest.main()
但是,如果我尝试使用PyCharm 中的此按钮仅重新运行失败的测试,它将重新运行我的所有测试。我如何只重新运行失败的测试?