Replace self.mock_* pairs by self.mocked_* context managers#5157
Open
Flamefire wants to merge 1 commit into
Open
Replace self.mock_* pairs by self.mocked_* context managers#5157Flamefire wants to merge 1 commit into
self.mock_* pairs by self.mocked_* context managers#5157Flamefire wants to merge 1 commit into
Conversation
6bb272a to
359f379
Compare
359f379 to
70c1333
Compare
Make sure cleanup happens
70c1333 to
d78dd8c
Compare
Crivella
requested changes
Jun 12, 2026
|
|
||
| @contextmanager | ||
| def mocked_stdout(self): | ||
| def mocked_stdout(self, force_tty=False): |
Contributor
There was a problem hiding this comment.
force_tty should be used when turning the mocked pipe ON and not when turning it OFF (enabling it on the normal stdout/stderr should be a separate operation if ever needed)
Contributor
Author
There was a problem hiding this comment.
This is the function that turns the mocked pipe ON. Or do you mean something different?
Contributor
There was a problem hiding this comment.
I mean it should be
self.mock_stdout(True, force_tty=force_tty)
...
self.mock_stdout(False)
instead of the other way around
wanted to suggest it as a change but i think the tool does not like suggestions going over deleted lines(?) and was giving weird stuff
|
|
||
| @contextmanager | ||
| def mocked_stderr(self): | ||
| def mocked_stderr(self, force_tty=False): |
| self.assertTrue(re.match('^[0-9a-f]{40}$', read_file(shafile))) | ||
| self.assertExists(os.path.join(repodir, 'easybuild', 'easyblocks', '__init__.py')) | ||
| self.mock_stdout(False) | ||
| # stdout capture released by context manager above |
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.
Make sure cleanup happens
Followup to #5125 by adding the
force_ttyparameter to the context managersShould be merged soon as this is prone to merge conflicts