pytest-dev / pytest-dev/pytest
Ensure stdin and stdout are in blocking mode before writing test summary
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
Hello,
I'm running unit tests in parallel with such configuration:
platform linux2 -- Python 2.7.12, pytest-3.0.6, py-1.4.31, pluggy-0.4.0 -- /tmp/pyve/bin/python2
plugins: timeout-1.2.0, xdist-1.15.0, cov-2.4.0
And I'm getting quite often such exception as follows.
As this is temporary problem with writing output maybe there could be added a loop
that catches this exception and tries again at least several times?
Traceback (most recent call last):
File "/tmp/pyve/bin/py.test", line 11, in <module>
sys.exit(main())
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/config.py", line 57, in main
return config.hook.pytest_cmdline_main(config=config)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/main.py", line 127, in pytest_cmdline_main
return wrap_session(config, _main)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/main.py", line 122, in wrap_session
exitstatus=session.exitstatus)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
wrap_controller.send(call_outcome)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/terminal.py", line 367, in pytest_sessionfinish
self.summary_failures()
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/terminal.py", line 484, in summary_failures
self._outrep_summary(rep)
File "/tmp/pyve/local/lib/python2.7/site-packages/_pytest/terminal.py", line 513, in _outrep_summary
self._tw.line(content)
File "/usr/lib/python2.7/dist-packages/py/_io/terminalwriter.py", line 201, in line
self.write(s, **kw)
File "/usr/lib/python2.7/dist-packages/py/_io/terminalwriter.py", line 198, in write
write_out(self._file, markupmsg)
File "/usr/lib/python2.7/dist-packages/py/_io/terminalwriter.py", line 333, in write_out
fil.write(msg)
IOError: [Errno 11] Resource temporarily unavailable
make: *** [tests] Error 1
make: write error: stdout
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with _pytest/terminal.py at pytest_sessionfinish, summary_failures, and _outrep_summary, then inspect py/_io/terminalwriter.py where the traceback writes to the stream. Reproduce with parallel tests and determine how terminal output should handle Errno 11; done means the test summary is written reliably without the reported resource-temporarily-unavailable failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100