Skip to content

[WIP] TEST: junitxml: write_captured_output: assert for flakiness #5959

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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/_pytest/junitxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ def write_captured_output(self, report):
else:
content = content_err

# XXX: flaky in test suite, trying to figure out why.
assert content, repr([content, content_log, content_err])
if content:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoddemus
Any idea why this might be Falsy during tests?
Does this happen during failures of outer tests then only?

Does it make sense to cover this branch, or should we either assert it here then always (probably a bad idea since it is covered sometimes), or just ignore it for coverage (# pragma: no branch)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, do you have an example failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

tag = getattr(Junit, "system-err")
self.append(tag(bin_xml_escape(content)))
Expand Down