Skip to content

Fix test refactoring #350

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

Merged
merged 3 commits into from
Mar 23, 2025
Merged

Fix test refactoring #350

merged 3 commits into from
Mar 23, 2025

Conversation

aaronliu0130
Copy link
Member

Replace self.fail()s
Fix edge case of verifying categories when running pytest on a specific function through module notation Fix indented parameter test
Make _Seen_Error_Categories a set
Make clitest setup and teardown conform to naming

Replace self.fail()s
Fix edge case of verifying categories when running pytest on a specific function through module notation
Fix indented parameter test
Make _Seen_Error_Categories a set
Make clitest setup and teardown conform to naming
@aaronliu0130 aaronliu0130 requested a review from cclauss March 22, 2025 19:07
@cclauss cclauss added the tests label Mar 23, 2025
for line in error_collector.ResultList():
if line.find("build/header_guard") != -1:
self.fail("Unexpected error: %s" % line)
assert not any("build/header_guard" in line for line in error_collector.ResultList())
Copy link
Member

@cclauss cclauss Mar 23, 2025

Choose a reason for hiding this comment

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

Although ruff rule SIM110 recommends the use of any() because it is much easier to read and understand, it may make pytest results harder to understand because it may not show the text on those lines that fail.

Also, (I learned the hard way) that any() is actually slower than the long form that it replaces.

Copy link
Member Author

@aaronliu0130 aaronliu0130 Mar 23, 2025

Choose a reason for hiding this comment

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

Apparently it is faster than the form it replaces if you use it like any(True for line in error_collector.ResultList() if "build/header_guard" in line) instead, but you're right that it doesn't show the line.

@aaronliu0130 aaronliu0130 requested a review from cclauss March 23, 2025 12:54
@aaronliu0130 aaronliu0130 merged commit 9107df4 into cpplint:develop Mar 23, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy