-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[v2] Use AssertionError instead of unittest.TestCase.fail for S3 memory assertion integration tests #9873
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
Conversation
This test does not inherit from a unittest, so it does not have a fail method. This change makes the test raise a AssertionError with the existing failure message.
5f74af3 to
c105b78
Compare
aemous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall. one nit, open to discussion
|
|
||
| def assert_max_memory_used(self, process, max_mem_allowed, full_command): | ||
| peak_memory = max(process.memory_usage) | ||
| if peak_memory > max_mem_allowed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking: would assert peak_memory <= max_mem_allowed, failure_message be more consistent/idiomatic with the rest of our codebase? This way it only fails when assertions are enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine moving it to an idiomatic expression, but wouldn't raising an AssertionError and calling assert result in the same thing, and would fail identically if assertions are enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in edfe92a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah to clarify my comment was more about being idiomatic. Secondarily if you run it with assertions disabled then the behavior is different, this may be a moot point since PyTest enables assertions.
Replace the AssertionError with a idiomatic assert statement.
aemous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue #, if available:
Description of changes:
Integration tests were ported from CLI v1, but some were altered to not inherit from a
unittest.TestCase, so it does not have a fail method. Tests using theassert_max_memory_usedwill fail incorrectly and not print the failure message. This change makes the test raise anAssertionErrorwith the existing failure message.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.