testing: add get_cloud function (SC-461)#1038
Merged
Merged
Conversation
6fb1193 to
7f286d8
Compare
TheRealFalcon
commented
Sep 28, 2021
| return mock_writefile, mock_loadfile, mock_isfile, mock_shouldcfg | ||
| mycloud = get_cloud(distro) | ||
|
|
||
| with ExitStack() as stack: |
Contributor
Author
There was a problem hiding this comment.
The get_cloud call in these tests included a call to patchUtils, so updated this section to also mock out del_file. The rest is just syntactic sugar to not have so much nesting with the mocks.
Member
|
Looks good to me. |
e4ad32d to
edc0bb8
Compare
blackboxsw
approved these changes
Oct 16, 2021
Comment on lines
+28
to
+33
| def abstract_to_concrete(abclass): | ||
| """Takes an abstract class and returns a concrete version of it.""" | ||
| class concreteCls(abclass): | ||
| pass | ||
| concreteCls.__abstractmethods__ = frozenset() | ||
| return type('DummyConcrete' + abclass.__name__, (concreteCls,), {}) |
Collaborator
There was a problem hiding this comment.
Very nice; this works. I was a bit hesitant about using this approach as I wondered why TestingDistro couldn't be used in tests/unittests/test_distros/test_create_users.py but I get that create_users is trying to assert on the actual base abstract class. +1.
This was referenced May 12, 2023
Closed
Closed
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.
Proposed Commit Message
Additional Context
The main change is
util.py. Mostly everything else is updating call points.Test Steps
Checklist: