Skip to content
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

Fix sorting of junit tests in presence of a timeout #8600

Merged
merged 1 commit into from Nov 11, 2019

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Nov 8, 2019

Problem

When we timeout or when junit XML is corrupted for some reason, it can prevent us from identifying the target that failed, which causes us to default to a None cluster of tests.

We knew this already though, and the codepath that parsed tests accounted for it. But we had missed a case.

Solution

Default to the empty string rather than None when sorting tests.

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Ha. This strikes again..this was one of the trickiest pieces of code to port to Py3.

You can probably drop "under Python 3" in the PR title - we're well past being able to use Py2.

--

Thanks for fixing this!

target_to_failed_test = parse_failed_targets(test_registry, output_dir, parse_error_handler)

def sort_owning_target(t):
return t.address.spec if t else None
return t.address.spec if t else ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Even with the NB above, I'd still add

NB: we use the empty string rather than None to ensure comparisons do not fail.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

There are now two comments in this method body, heh. I added one before seeing the one below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to update the below comment to simply say Python does not allow instead of Python 3 :) 40 more days until Python 2 is officially EOL!

@stuhood stuhood changed the title Fix sorting of junit tests in presence of a timeout under python 3 Fix sorting of junit tests in presence of a timeout Nov 9, 2019
@stuhood stuhood merged commit 345aa07 into pantsbuild:master Nov 11, 2019
@stuhood stuhood deleted the stuhood/junit-comparison-to-none branch November 11, 2019 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants