Skip to content

Conversation

@kdaily
Copy link
Member

@kdaily kdaily commented Nov 24, 2025

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 the assert_max_memory_used will fail incorrectly and not print the failure message. This change makes the test raise an AssertionError with 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.

@kdaily kdaily requested a review from a team November 24, 2025 18:44
@kdaily kdaily added the v2 label Nov 24, 2025
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.
@kdaily kdaily force-pushed the s3-assert-max-memory-used-test-fix branch from 5f74af3 to c105b78 Compare November 24, 2025 20:58
@kdaily kdaily changed the title [v2] Use MemoryError instead of unittest.TestCase.fail for S3 memory assertion integration tests [v2] Use AssertionError instead of unittest.TestCase.fail for S3 memory assertion integration tests Nov 24, 2025
Copy link
Contributor

@aemous aemous left a 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:
Copy link
Contributor

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

Copy link
Member Author

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in edfe92a

Copy link
Contributor

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.
Copy link
Contributor

@aemous aemous left a comment

Choose a reason for hiding this comment

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

LGTM

@kdaily kdaily merged commit 30804d3 into aws:v2 Nov 25, 2025
44 of 45 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