@tly
我在执行pytest的时候,程序爆出一下错误:
E invoke.exceptions.ThreadException:
E Saw 1 exceptions within threads (OSError):
E
E
E Thread args: {'kwargs': {'echo': None,
E 'input_': <_pytest.capture.DontReadFromInput object at 0x7fee74656278>,
E 'output': <_pytest.capture.EncodedFile object at 0x7fee74656470>},
E 'target': <bound method Runner.handle_stdin of <fabric.runners.Remote object at 0x7fee706d1978>>}
E
E Traceback (most recent call last):
E
E File "/root/venv/tamper_console/lib/python3.6/site-packages/invoke/util.py", line 233, in run
E super(ExceptionHandlingThread, self).run()
E
E File "/usr/local/lib/python3.6/threading.py", line 864, in run
E self._target(*self._args, **self._kwargs)
E
E File "/root/venv/tamper_console/lib/python3.6/site-packages/invoke/runners.py", line 641, in handle_stdin
E data = self.read_our_stdin(input_)
E
E File "/root/venv/tamper_console/lib/python3.6/site-packages/invoke/runners.py", line 601, in read_our_stdin
E bytes_ = input_.read(bytes_to_read(input_))
E
E File "/root/venv/tamper_console/lib/python3.6/site-packages/_pytest/capture.py", line 693, in read
E raise IOError("reading from stdin while output is captured")
E
E OSError: reading from stdin while output is captured
临时解决办法,运行命令:
pytest test_xxx.py --capture=no
禁止捕获输出;
原因:
TODO