0

I am trying to generate XML allure reports through PyCharm on my pytest project. I have installed allure-pytest and required packages for the test cases to run. However when I try to install pytest-allure-adaptor from File -> Settings -> Project Interpreter I get the error as follows :

"error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/"

I have installed Visual C++ Redistributable for Visual Studio 2015 but it doesn't help. Please help me with a solution.

When I use pytest command to run my project I get the below error after install adaptor via pip install pytest-allure-adaptor :

Traceback (most recent call last):
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\geeth\AppData\Local\Programs\Python\Python38\Scripts\pytest.exe\__main__.py", line 9, in <module>
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 105, in main
    config = _prepareconfig(args, plugins)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 257, in _prepareconfig
    return pluginmanager.hook.pytest_cmdline_parse(
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 203, in _multicall
    gen.send(outcome)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\helpconfig.py", line 90, in pytest_cmdline_parse
    config = outcome.get_result()
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 836, in pytest_cmdline_parse
    self.parse(args)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 1044, in parse
    self._preparse(args, addopts=addopts)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 992, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 299, in load_setuptools_entrypoints
    plugin = ep.load()
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
    exec(co, module.__dict__)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure_pytest\plugin.py", line 3, in <module>
    import allure
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
    exec(co, module.__dict__)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\__init__.py", line 1, in <module>
    from allure.pytest_plugin import MASTER_HELPER
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
    exec(co, module.__dict__)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\pytest_plugin.py", line 9, in <module>
    from allure.common import AllureImpl, StepContext
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
    exec(co, module.__dict__)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\common.py", line 19, in <module>
    from allure.structure import Attach, TestStep, TestCase, TestSuite, Failure, Environment, EnvParameter
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
    exec(co, module.__dict__)
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\structure.py", line 14, in <module>
    class Attach(xmlfied('attachment',
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\rules.py", line 116, in xmlfied
    class MyImpl(namedlist('XMLFied', [(item[0], None) for item in items])):
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\namedlist.py", line 381, in namedlist
    type_dict = {'__init__': _make_fn('__init__', _nl_init, fields, defaults),
  File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\namedlist.py", line 180, in _make_fn
    code = compile(module_node, '<string>', 'exec')
TypeError: required field "posonlyargs" missing from arguments
Geethika
  • 27
  • 7
  • Which Python version you are using? Looks like the PyPi package is a source package instead of a Windows binary package. Did you install the latest version? – MrBean Bremen Aug 06 '20 at 11:27
  • And have you tried to install it outside of PyCharm using `pip install` in your environment? – MrBean Bremen Aug 06 '20 at 11:28
  • I am using Python 3.8.5. I tried installing using pip install but my code gives weird errors which is why I tried to install it via PyCharm. Now PyCharm won't even open after the Redistributable installation. – Geethika Aug 07 '20 at 11:51
  • If it doesn't install via `pip install` it will also not install under PyCharm - PyCharm uses pip for installation. What are thes weird errors? Can you add this to the question? – MrBean Bremen Aug 07 '20 at 12:45
  • I have edited my question and have added the errors. – Geethika Aug 08 '20 at 06:06
  • Ok, I understand that you have successfully installed the package via `pip install`, and after that PyCharm crashes while opening, or while opening your project - is this correct? That would mean the problem is with the package itself (some compatibility issue maybe) or with your project. Have you looked at [this issue](https://stackoverflow.com/questions/50934480/error-after-installation-of-allure-pytest-adaptor)? – MrBean Bremen Aug 08 '20 at 06:39
  • I geet the error when running the project using pytest command. Without the package installed the project runs just fine – Geethika Aug 08 '20 at 07:55
  • Ok, so it may be some incompatibility between packages. Maybe you should try to uninstall all packages not directly needed. Also it could help to have the full trace - the one you posted is cut off in the middle and not showing the actual error. – MrBean Bremen Aug 08 '20 at 08:32
  • Should I install an older version of pytest-allure-adaptor ? I have added the full trace. – Geethika Aug 08 '20 at 11:45
  • If searching for the error message, several issues come up which are all related to a change in Python 3.8 - so it may just be that the module is not compatible with Python 3.8. Checking the GitHub page turned out that the `pytest-allure-adaptor` is deprecated and not maintained anymore (and only works up to `allure 1.4.x` ), so you probably should not use it at all. Could have checked this before... ah well – MrBean Bremen Aug 08 '20 at 12:32
  • 1
    Okay. Thanks for your help in identifying the issue. I have uninstalled it and am using "allure serve reports_folder" command for generating reports after installing the allure command-line and it works! – Geethika Aug 08 '20 at 13:06

0 Answers0