TA的每日心情 | 无聊 昨天 09:47 |
---|
签到天数: 528 天 连续签到: 1 天 [LV.9]测试副司令
|
1测试积点
pytest 执行 pytest.main(['-s', '-q', '--alluredir', 'report/result', 'test.py']) 时报错 AttributeError: module 'allure' has no attribute 'severity_level',网上说卸载后安装新版本即可,但是试过还是有这个问题测试代码:
- import pytest
- import os
- class TestPytest(object):
- def test_one(self):
- print("test_one 方法执行")
- assert 1 == 1
- def test_two(self):
- print("test_two 方法执行")
- assert "s" in "love"
- def test_three(self):
- print("test_three 方法执行")
- assert 3 - 2 == 1
- if name == "main":
- pytest.main(['-s', '-q', '--alluredir', 'report/result', 'test.py'])
- 完整报错:
- Traceback (most recent call last):
- File "F:\pycharm\PyCharm Community Edition 2021.1.1\plugins\python-ce\helpers\pycharm_jb_pytest_runner.py", line 46, in
- sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
- File "F:\python\lib\site-packages_pytest\config_init.py", line 143, in main
- config = _prepareconfig(args, plugins)
- File "F:\python\lib\site-packages_pytest\config__init.py", line 319, in _prepareconfig
- pluginmanager=pluginmanager, args=args
- File "F:\python\lib\site-packages\pluggy\hooks.py", line 286, in __call_
- return self.hookexec(self, self.get_hookimpls(), kwargs)
- File "F:\python\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
- return self._inner_hookexec(hook, methods, kwargs)
- File "F:\python\lib\site-packages\pluggy\manager.py", line 87, in
- firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
- File "F:\python\lib\site-packages\pluggy\callers.py", line 203, in _multicall
- gen.send(outcome)
- File "F:\python\lib\site-packages_pytest\helpconfig.py", line 100, in pytest_cmdline_parse
- config: Config = outcome.get_result()
- File "F:\python\lib\site-packages\pluggy\callers.py", line 80, in get_result
- raise ex[1].with_traceback(ex[2])
- File "F:\python\lib\site-packages\pluggy\callers.py", line 187, in _multicall
- res = hook_impl.function(*args)
- File "F:\python\lib\site-packages_pytest\config__init.py", line 1003, in pytest_cmdline_parse
- self.parse(args)
- File "F:\python\lib\site-packages_pytest\config__init.py", line 1283, in parse
- self._preparse(args, addopts=addopts)
- File "F:\python\lib\site-packages_pytest\config__init.py", line 1172, in _preparse
- self.pluginmanager.load_setuptools_entrypoints("pytest11")
- File "F:\python\lib\site-packages\pluggy\manager.py", line 300, in load_setuptools_entrypoints
- self.register(plugin, name=ep.name)
- File "F:\python\lib\site-packages_pytest\config__init_.py", line 436, in register
- ret: Optional[str] = super().register(plugin, name)
- File "F:\python\lib\site-packages\pluggy\manager.py", line 127, in register
- hook._maybe_apply_history(hookimpl)
- File "F:\python\lib\site-packages\pluggy\hooks.py", line 333, in _maybe_apply_history
- res = self._hookexec(self, [method], kwargs)
- File "F:\python\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
- return self._inner_hookexec(hook, methods, kwargs)
- File "F:\python\lib\site-packages\pluggy\manager.py", line 87, in
- firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
- File "F:\python\lib\site-packages\pluggy\callers.py", line 208, in _multicall
- return outcome.get_result()
- File "F:\python\lib\site-packages\pluggy\callers.py", line 80, in get_result
- raise ex[1].with_traceback(ex[2])
- File "F:\python\lib\site-packages\pluggy\callers.py", line 187, in _multicall
- res = hook_impl.function(*args)
- File "F:\python\lib\site-packages\allure_pytest\plugin.py", line 48, in pytest_addoption
- severities = [x.value for x in list(allure.severity_level)]
- AttributeError: module 'allure' has no attribute 'severity_level'
复制代码
|
|