Fix C&P error in test_toy_cuda_sanity_check and simplify#5183
Open
Flamefire wants to merge 2 commits into
Open
Fix C&P error in test_toy_cuda_sanity_check and simplify#5183Flamefire wants to merge 2 commits into
test_toy_cuda_sanity_check and simplify#5183Flamefire wants to merge 2 commits into
Conversation
Use `assertRegex` or `assertIn` and remove message variables
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The major issue was in
assert_cuda_reportwhich wrongly was callingassert_regex(num_checked_str, outtxt, stdout).But the parameter to the function is
lognotouttxtThis went undetected because we do not enable the Flake8 check for unused variables/parameters.
I'd argue we should, even if that means a bit initial refactoring: Most uses should be ok, so we simply silence the warning by using
_as the name or prefix the variable with an underscore.While doing that I noticed that there are a lot of
assertTruechecks when testing for a regex. In #5137 I replaced many of those already by the betterassertRegexwhich avoids us having to specify the message.This removes almost half of the lines of the test: 1. Compile regex, 2. Assemble message, 3. do the check are replaced by just doing the check.
There were also cases where the regex was wrong, e.g.
r"Missing compute capabilities: 8.0."The dot would need to be escaped, but the better check is
assertIn, we don't need a regex here.