-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send one character (no newline) to stdout in protocol test to guarantee a single "message" and thus a single custom value #6978
Send one character (no newline) to stdout in protocol test to guarantee a single "message" and thus a single custom value #6978
Conversation
This commit modifies datalad.support.tests.test_witless_runner.test_parameterized_protocol() to only send a single character to the subprocess. That should fix issue datalad#4921, where protocol.pipe_data_received() might be triggered twice, if the stdout-pipe decides to split up the previously used two-characters string. In addition the commit disabled the result renderer for add in datalad.support.tests.test_annex_repo.test_files_split() to reduce the number of logged output lines.
Code Climate has analyzed commit bc4ded8 and detected 0 issues on this pull request. View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ideally should be against
maint
notmaster
- moving (will remove there) my question/comment from the underlying issue:
Thanks @christian-monch for the analysis!!! I fail to see how/why changing the test "fixes" the situation in christian-monch@bc4ded8#diff-472642261afcc22bd6f543b4a8c20533588ec9281bd964137b29f79885e56164L197 ? Test code seems to be totally legit - just running a command which prints a single character, so should not be changed. IMHO it is the code of the runner is wrong somewhere that it manages to duplicate that single character, so better be fixed in the code (not in the test). Or what am I missing?
Codecov Report
@@ Coverage Diff @@
## maint #6978 +/- ##
==========================================
+ Coverage 90.13% 90.68% +0.54%
==========================================
Files 354 354
Lines 46326 47355 +1029
Branches 6613 6609 -4
==========================================
+ Hits 41755 42942 +1187
+ Misses 4554 4397 -157
+ Partials 17 16 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
The test code did NOT send a single character! It sent two characters. The reason is that the print-function appends an ❱ python -c "print('1')"|wc -c 130 !
2
❱ python -c "print('1', end='')"|wc -c
1 |
Thx. Fixed! |
you kept saying that and I was "why he keeps saying that?" ;) Looked at the test code and the purpose of that test and got it - indeed there is an assumption in the test that there would be a single message/invocation of the |
🚀 PR was released in |
Fixes issue #4921
This PR modifies the test
datalad.support.tests.test_witless_runner.test_parameterized_protocol()
to only send a single character to
stdout
of the subprocess, i.e.1
. Previously two characters weresent, i.e.
1
and\n
. Depending on the behavior of the stdout-pipe, the data might be split up ordelivered in toto. In the first case, which is rare, the
protocol.pipe_data_received()
will be calledtwice, leading to an unexpected result.
Changelog
🐛 Bug Fixes