allure-python
allure-python copied to clipboard
Error importing plugin "allure.pytest_plugin": No module named 'allure.pytest_plugin'; 'allure' is not a package
allure 2.27.0 allure_pytest 2.14.4 pytest 7.4.4 Python3.7
запуск из терминала Pycharm
ошибка:
PS C:\Users\user\PycharmProjects\Torch> C:/python37/python.exe "C:/Program Files/JetBrains/PyCharm Community Edition 2023.3/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py" --path=C:/Users/user/PycharmProjects/Torch/test/up
date_boo.py --target=test_update_boo -- --alluredir=./reports/reports
Launching pytest with arguments --alluredir=./reports/reports C:/Users/user/PycharmProjects/Torch/test/update_boo.py --no-header --no-summary -q in C:\Users\user\PycharmProjects\Torch
Traceback (most recent call last):
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 781, in import_plugin
__import__(importspec)
ModuleNotFoundError: No module named 'allure.pytest_plugin'; 'allure' is not a package
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:/Program Files/JetBrains/PyCharm Community Edition 2023.3/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py", line 60, in <module>
sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 150, in main
config = _prepareconfig(args, plugins)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 332, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "C:\python37\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "C:\python37\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "C:\python37\lib\site-packages\pluggy\_callers.py", line 55, in _multicall
gen.send(outcome)
File "C:\python37\lib\site-packages\_pytest\helpconfig.py", line 104, in pytest_cmdline_parse
config: Config = outcome.get_result()
File "C:\python37\lib\site-packages\pluggy\_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "C:\python37\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 1075, in pytest_cmdline_parse
self.parse(args)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 1425, in parse
self._preparse(args, addopts=addopts)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 1328, in _preparse
early_config=self, args=args, parser=self._parser
File "C:\python37\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "C:\python37\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "C:\python37\lib\site-packages\pluggy\_callers.py", line 60, in _multicall
return outcome.get_result()
File "C:\python37\lib\site-packages\pluggy\_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "C:\python37\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 1159, in pytest_load_initial_conftests
importmode=early_config.known_args_namespace.importmode,
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 563, in _set_initial_conftests
self._try_load_conftest(anchor, importmode, rootpath)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 580, in _try_load_conftest
self._getconftestmodules(anchor, importmode, rootpath)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 609, in _getconftestmodules
mod = self._importconftest(conftestpath, importmode, rootpath)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 657, in _importconftest
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 657, in _importconftest
self.consider_conftest(mod)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 739, in consider_conftest
self.register(conftestmodule, name=conftestmodule.__file__)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 498, in register
self.consider_module(plugin)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 747, in consider_module
self._import_plugin_specs(getattr(mod, "pytest_plugins", []))
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 754, in _import_plugin_specs
self.import_plugin(import_spec)
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 785, in import_plugin
).with_traceback(e.__traceback__) from e
File "C:\python37\lib\site-packages\_pytest\config\__init__.py", line 781, in import_plugin
__import__(importspec)
ImportError: Error importing plugin "allure.pytest_plugin": No module named 'allure.pytest_plugin'; 'allure' is not a package
Looks like your configuration of pytest is trying to enable the deprecated adapter.
I would check the configuration first. The allure.pytest_plugin entry point must've sneaked in somewhere. It might be in pytest.ini:
[pytest]
addopts = -p allure.pytest_plugin
Or in pyproject.toml:
[tool.pytest.ini_options]
addopts = "-p allure.pytest_plugin"
Either remove it or change it to allure_pytest - the entry point of the current adapter (the one sourced in this repository).