✅ Add tests for hostpython3 recipe#2196
Merged
opacam merged 1 commit intokivy:developfrom May 16, 2020
Merged
Conversation
This will cover **100%** of the code for the hostpython3 recipe. Also we migrate `os.path.exists` and `os.path.isfile` to `pathlib.Path`'s implementation because when we mock these functions, it seems that property `return_value` is being ignored.
AndreMiras
approved these changes
May 13, 2020
Member
AndreMiras
left a comment
There was a problem hiding this comment.
LGTM, I still find the self.assert* syntax not as nice to read as a simple neatly aligned assert same thing for the Mock.assert_* calls. I know it's a matter of taste and I use to like the other way, but definitely not anymore.
Also pytest brings nice features like parametrize that could have been used in a couple of tests to make it more concise, but that's also not possible when using the unittest.TestCase boiler plate
| self.assertEqual(e.exception.args[0], HOSTPYTHON_VERSION_UNSET_MESSAGE) | ||
| # restore recipe's version or we will get failures with other test, | ||
| # since we share `self.recipe with all the tests of the class | ||
| self.recipe._version = hostpython_version |
Member
There was a problem hiding this comment.
I think this is probably fine, but usually a safe way to handle theses things is through context managers.
e.g. #1948
I would say let's keep it simple as you did, but just wanted to share the use of this old PR
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.
This will cover 100% of the code for the hostpython3 recipe.
Also we migrate
os.path.existsandos.path.isfiletopathlib.Path's implementation because when we mock these functions, it seems that propertyreturn_valueis being ignored.