Skip to content

✅ Add tests for hostpython3 recipe#2196

Merged
opacam merged 1 commit intokivy:developfrom
opacam:feature-hostpython3-tests
May 16, 2020
Merged

✅ Add tests for hostpython3 recipe#2196
opacam merged 1 commit intokivy:developfrom
opacam:feature-hostpython3-tests

Conversation

@opacam
Copy link
Member

@opacam opacam commented May 13, 2020

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.

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

@AndreMiras AndreMiras left a comment

Choose a reason for hiding this comment

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

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
Copy link
Member

Choose a reason for hiding this comment

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

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

@opacam opacam merged commit 5e90f06 into kivy:develop May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants