Getting Error while running Mutation testing on Python code : AttributeError: 'MutationTestRunnerThread' object has no attribute 'isAlive'

Getting Error while running Mutation testing on Python code : AttributeError: 'MutationTestRunnerThread' object has no attribute 'isAlive'

我正在使用 Mut.py 进行 Python 编程突变测试。单元测试已通过,当我 运行 使用命令在命令行上进行 Mutation 测试时,出现这样的错误。

C:\Users\pc\Desktop\My_Projects\Calculator01>mut.py --target simpleCalculator.py --unit-test test_simpleCalculator.py --runner pytest --coverage
Traceback (most recent call last):
  File "C:\Users\pc\AppData\Local\Programs\Python\Python39\Scripts\mut.py", line 7, in <module>
    commandline.main(sys.argv)
  File "c:\users\pc\appdata\local\programs\python\python39\lib\site-packages\mutpy\commandline.py", line 10, in main
    run_mutpy(parser)
  File "c:\users\pc\appdata\local\programs\python\python39\lib\site-packages\mutpy\commandline.py", line 61, in run_mutpy
    mutation_controller = build_controller(cfg)
  File "c:\users\pc\appdata\local\programs\python\python39\lib\site-packages\mutpy\commandline.py", line 73, in build_controller
    return controller.MutationController(
  File "c:\users\pc\appdata\local\programs\python\python39\lib\site-packages\mutpy\controller.py", line 60, in __init__
    self.runner = runner_cls(self.test_loader, self.timeout_factor, self.stdout_manager, mutate_covered)
  File "c:\users\pc\appdata\local\programs\python\python39\lib\site-packages\mutpy\test_runners\base.py", line 150, in __init__
    self.init_modules = self.find_init_modules()
  File "c:\users\pc\appdata\local\programs\python\python39\lib\site-packages\mutpy\test_runners\base.py", line 209, in find_init_modules
    test_runner.terminate()
  File "c:\users\pc\appdata\local\programs\python\python39\lib\site-packages\mutpy\utils.py", line 357, in terminate
    if self.isAlive():
**AttributeError: 'MutationTestRunnerThread' object has no attribute 'isAlive'**

有人可以帮忙吗?

我最近遇到了同样的问题,这里有一个对我有用的快速修复:

  • 打开错误信息中显示的utils.py
  • 转到错误消息中显示的“if self.isAlive():”行
  • 进行以下更改: if self.isAlive(): 成为 if self.is_alive():

我的电脑 运行 Windows 10 python 3.9.0,mutpy 0.6.1.