Repository navigation
Fixed #31370 -- Added support for parallel tests with --buffer. - #12580
Conversation
|
I've also added a commit to make the Tbh I'm in favour of making buffer the default for all users. We could add an |
|
Paging @bmispelon for review since you wrote the first buffer PR #12169. |
d5d9a9d to
a883a95
Compare
883533c to
b9d2213
Compare
bmispelon
left a comment
There was a problem hiding this comment.
This subclassing approach seems a lot more clean to me. I think it's the right one.
I've suggested two minor changes but they're not blocking at all.
I don't have an opinion on the change to make buffer the default (or for forcing it to True for runtests.py).
|
Rebased. I also made a ticket to propose making buffering the default, with a |
|
@Valze you may also be interested to see or review this PR, since it's test runner related. |
I've been keeping an eye on it ever since you started solving it initially a month and a half ago. I'll give it a more thorough read over this weekend and see if I can help in any way. |
|
Code looks much cleaner after subclassing TextResult, and it really does improve a lot of other written methods. I'm +1 on setting buffer as the default option. It removes unnecessary clutter |
Thanks. Can you repeat that on the ticket ? |
There was a problem hiding this comment.
@adamchainz Thanks 👍
IMO we shouldn't change the current behavior of runtests.py I find it valuable, so I would recommend to chop the second commit. Lets be honest we "all" use print() in tests to check sth 😄. Folks who are concerned here can add the flag. (It's not much of a burden.)
| ) | ||
| with self.assertRaisesMessage(ValueError, msg): | ||
| DiscoverRunner(buffer=True, parallel=2) | ||
|
|
There was a problem hiding this comment.
Can we add a test? similar to the test_buffer_mode_test_pass().
There was a problem hiding this comment.
I tried:
def test_buffer_mode_parallel(self):
runner = DiscoverRunner(parallel=2, buffer=True, verbose=0)
with captured_stdout() as stdout, captured_stderr() as stderr:
suite = runner.build_suite([
'test_runner_apps.buffer.tests_buffer.WriteToStdoutStderrTestCase.test_pass',
'test_runner_apps.buffer.tests_buffer.WriteToStdoutStderrTestCase2.test_pass',
])
runner.run_suite(suite)
self.assertNotIn('Write to stderr.', stderr.getvalue())
self.assertNotIn('Write to stdout.', stdout.getvalue())But this doesn't work because we can't capture stdin/stdout across the parallel processes. Any suggestions?
|
@adamchainz Do you have time to check my comments and polish this patch? |
e761da7 to
da4815c
Compare
|
I finally got back to this. |
|
@adamchainz Thanks for updates 👍 I still believe that we should drop the last commit and keep the current (default) behavior for @carltongibson Can I ask for your opinion? |
|
I'm happy to drop the last commit if you think so, but I have not seen any pytest users complain about its automatic buffering. You can always do |
carltongibson
left a comment
There was a problem hiding this comment.
Yes, please, can we not change the behaviour of ./runtests.py here. (-s is amongst my favourite pytest options.)
Otherwise looks good.
da4815c to
e8fa478
Compare
|
Okay I dropped the change to |
felixxm
left a comment
There was a problem hiding this comment.
@adamchainz Thanks for updates 👍 I pushed edits to the first two commits and noticed one issue.
|
@adamchainz Also, it doesn't really work for me. I think you missed passing |
Ah thanks. I think I accidentally dropped that in the rebase-and-split. |
709738c to
36167d5
Compare
|
I noticed that signature are outdated, see #14145. |
|
@adamchainz Thanks 👍 It's ready to go 🌟 |
|
🙌 🚀 |
ticket