Я пытаюсь запустить pytest на ПК с Windows.На одной машине все работает нормально, но другая выдает ошибку, даже когда я просто пытаюсь pytest.exe --version
.Работающий компьютер - это бизнес-версия Windows 10, но эта версия - Windows 10 Home (x64).На нем установлено несколько версий Python, но я попытался запустить его под 3.6 и 3.6-32 без разницы в результатах.
Он был установлен через: py -3.6 -m pip install -U pytest
Вывод изработает pytest.exe --version
is:
PS C:\tests\unit> pytest.exe --version
Traceback (most recent call last):
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\pyuser\AppData\Local\Programs\Python\python36\Scripts\pytest.exe\__main__.py", line 9, in <module>
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\config\__init__.py", line 63, in main
config = _prepareconfig(args, plugins)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\config\__init__.py", line 207, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\callers.py", line 203, in _multicall
gen.send(outcome)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\helpconfig.py", line 94, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\config\__init__.py", line 687, in pytest_cmdline_parse
self.parse(args)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\config\__init__.py", line 895, in parse
self._preparse(args, addopts=addopts)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\config\__init__.py", line 851, in _preparse
early_config=self, args=args, parser=self._parser
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\callers.py", line 208, in _multicall
return outcome.get_result()
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\pluggy\callers.py", line 182, in _multicall
next(gen) # first yield
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\capture.py", line 50, in pytest_load_initial_conftests
_py36_windowsconsoleio_workaround(sys.stdout)
File "c:\users\pyuser\appdata\local\programs\python\python36\lib\site-packages\_pytest\capture.py", line 820, in _py36_windowsconsoleio_workaround
if not isinstance(raw_stdout, io._WindowsConsoleIO):
AttributeError: module 'io' has no attribute '_WindowsConsoleIO'
Я не могу найти никаких ссылок на эту проблему в Интернете, и я не знаю, почему в модуле io
отсутствует атрибут _WindowsConsoleIO
.