pytest OSError에서 오류 발생: [WinError 87] 매개변수가 잘못되었습니다.

pytest OSError에서 오류 발생: [WinError 87] 매개변수가 잘못되었습니다.

pytest를 설치했지만 명령 프롬프트에서 pytest --version을 테스트하는 동안 다음 오류가 발생합니다.

Traceback (most recent call last):

File "C:\Python\Scripts\pytest-script.py", line 11, in <module>

load_entry_point('pytest==5.1.0', 'console_scripts', 'pytest')()

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\config\__init__.py", line 58, in main

config = _prepareconfig(args, plugins)

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\config\__init__.py", line 208, in _prepareconfig

pluginmanager=pluginmanager, args=args

File "c:\python\lib\site-packages\pluggy\hooks.py", line 289, in __call__

return self._hookexec(self, self.get_hookimpls(), kwargs)

File "c:\python\lib\site-packages\pluggy\manager.py", line 87, in _hookexec

return self._inner_hookexec(hook, methods, kwargs)

File "c:\python\lib\site-packages\pluggy\manager.py", line 81, in <lambda>

firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,

File "c:\python\lib\site-packages\pluggy\callers.py", line 203, in _multicall

gen.send(outcome)

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\helpconfig.py", line 89, in pytest_cmdline_parse

config = outcome.get_result()

File "c:\python\lib\site-packages\pluggy\callers.py", line 80, in get_result

raise ex[1].with_traceback(ex[2])

File "c:\python\lib\site-packages\pluggy\callers.py", line 187, in _multicall

res = hook_impl.function(*args)

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\config\__init__.py", line 716, in pytest_cmdline_parse

self.parse(args)

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\config\__init__.py", line 924, in parse

self._preparse(args, addopts=addopts)

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\config\__init__.py", line 880, in _preparse

early_config=self, args=args, parser=self._parser

File "c:\python\lib\site-packages\pluggy\hooks.py", line 289, in __call__

return self._hookexec(self, self.get_hookimpls(), kwargs)

File "c:\python\lib\site-packages\pluggy\manager.py", line 87, in _hookexec

return self._inner_hookexec(hook, methods, kwargs)

File "c:\python\lib\site-packages\pluggy\manager.py", line 81, in <lambda>

firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,

File "c:\python\lib\site-packages\pluggy\callers.py", line 208, in _multicall

return outcome.get_result()

File "c:\python\lib\site-packages\pluggy\callers.py", line 80, in get_result

raise ex[1].with_traceback(ex[2])

File "c:\python\lib\site-packages\pluggy\callers.py", line 182, in _multicall

next(gen) # first yield

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\capture.py", line 42, in pytest_load_initial_conftests

_py36_windowsconsoleio_workaround(sys.stdout)

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\capture.py", line 819, in _py36_windowsconsoleio_workaround

sys.stdin = _reopen_stdio(sys.stdin, "rb")

File "c:\python\lib\site-packages\pytest-5.1.0-py3.7.egg\_pytest\capture.py", line 812, in _reopen_stdio

open(os.dup(f.fileno()), mode, buffering),

OSError: [WinError 87] The parameter is incorrect

어떻게 해결할 수 있나요?

답변1

이는 pytest/Python 버그로 인한 것 같습니다.

https://github.com/pytest-dev/pytest/issues/5724

https://bugs.python.org/issue37549

지금은 누군가가 해결 방법을 찾을 때까지 Python 3.7.3으로 다운그레이드할 수 있습니다.

관련 정보