PyTest выбрасывает параметр [WinError 87] не найден - PullRequest
0 голосов
/ 25 февраля 2020

В настоящее время я работаю над автоматизацией тестирования с использованием Python. Я пытался использовать Allure, который, во-первых, требует Pytest. После установки этих двух модулей я продолжил вызывать:

pytest --alluredir $OutputPath

Но получил сообщение параметр [WinError 87] не найден. Чтобы подтвердить, что Allure не вызывает проблемы, я попытался вызвать Pytest только через интерпретатор Python из командной строки с:

python -m pytest

, но все равно получил ту же ошибку. Глядя онлайн, эта ошибка уже давно произошла, но я не могу найти ответ. Я использую эти версии:

Python -> 3.7.4

Pytest -> 5.2.1

IDE -----> код Visual Studio

ОС -----> Windows 7

Полная трассировка:

Traceback (most recent call last):
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\c.hernandezperez\AppData\Local\Continuum\anaconda3\Scripts\pytest.exe\__main__.py", line 9, in <module>
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\config.py", line 54, in main
    config = _prepareconfig(args, plugins)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\config.py", line 167, in _prepareconfig
    pluginmanager=pluginmanager, args=args
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\__init__.py", line 617, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\callers.py", line 196, in _multicall
    gen.send(outcome)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\helpconfig.py", line 89, in pytest_cmdline_parse
    config = outcome.get_result()
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\callers.py", line 76, in get_result
    raise ex[1].with_traceback(ex[2])
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\callers.py", line 180, in _multicall
    res = hook_impl.function(*args)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\config.py", line 981, in pytest_cmdline_parse
    self.parse(args)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\config.py", line 1146, in parse
    self._preparse(args, addopts=addopts)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\config.py", line 1108, in _preparse
    early_config=self, args=args, parser=self._parser
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\__init__.py", line 617, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\callers.py", line 201, in _multicall
    return outcome.get_result()
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\callers.py", line 76, in get_result
    raise ex[1].with_traceback(ex[2])
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\pluggy\callers.py", line 175, in _multicall
    next(gen)   # first yield
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\capture.py", line 46, in pytest_load_initial_conftests
    _py36_windowsconsoleio_workaround(sys.stdout)
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\capture.py", line 711, in _py36_windowsconsoleio_workaround
    sys.__stdin__ = sys.stdin = _reopen_stdio(sys.stdin, "rb")
  File "c:\users\c.hernandezperez\appdata\local\continuum\anaconda3\lib\site-packages\_pytest\capture.py", line 704, in _reopen_stdio
    open(os.dup(f.fileno()), mode, buffering),
OSError: [WinError 87] El parámetro no es correcto

1 Ответ

0 голосов
/ 26 февраля 2020

Очевидно Python 3.7.4 не работает с Pytest, как указано в этом вопросе GitHub . Таким образом, этот вопрос считается ответом.

...