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

test: combine the asserts for output and errors #253

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

jnikula
Copy link
Owner

@jnikula jnikula commented Sep 11, 2024

With the output and error asserts separate, the test case ends on the first failing assertion, and we never know what was in errors. But the clue to the output mismatch might be in the errors. For example, an include file was not found. By combining the asserts into one, we get all the differences in the pytest results.

With the output and error asserts separate, the test case ends on the
first failing assertion, and we never know what was in errors. But the
clue to the output mismatch might be in the errors. For example, an
include file was not found. By combining the asserts into one, we get
all the differences in the pytest results.
Copy link
Collaborator

@BrunoMSantos BrunoMSantos left a comment

Choose a reason for hiding this comment

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

Good idea, I had a minor comment only, but it's good to go either way.

@@ -104,8 +104,7 @@ def run_test(self):

assert output_docs, 'empty output'
assert expect_docs, 'empty expected'
assert output_docs == expect_docs
assert output_errors == expect_errors
assert output_docs + output_errors == expect_docs + expect_errors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth to '\n'.join(...) to improve the diff or is output_docs guaranteed to end in a new line?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Per my testing, there's always been a newline, and the diff has looked fine with this. (And I've looked at plenty when trying to debug the macos CI issues.)

@jnikula jnikula merged commit 67c4ee3 into master Sep 12, 2024
6 checks passed
@jnikula jnikula deleted the test-combine-asserts branch September 12, 2024 11:36
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.

2 participants