Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe class unit tests #1676

Merged
merged 1 commit into from
Feb 5, 2019

Conversation

AndreMiras
Copy link
Member

Starts unit testing trivial cases for the Recipe class.
We will continue increasing the coverage as we encounter bugs.

Starts unit testing trivial cases for the `Recipe` class.
We will continue increasing the coverage as we encounter bugs.
@AndreMiras AndreMiras requested a review from inclement February 4, 2019 17:04
Copy link
Contributor

@KeyWeeUsr KeyWeeUsr left a comment

Choose a reason for hiding this comment

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

Seems fine to me.

@AndreMiras AndreMiras merged commit 0c4cd1d into kivy:master Feb 5, 2019
@opacam
Copy link
Member

opacam commented Feb 5, 2019

Ei, @AndreMiras, why do you initialize a Context() in each test? Maybe we could create ctx class variable and reuse that context for each test?

class TestRecipe(unittest.TestCase):
    def setUp(self):
        self.ctx = Context()

@ghost
Copy link

ghost commented Feb 5, 2019

@opacam it decreases the risk of side effects though to keep it separate, and it probably has like almost zero performance impact. I would personally recommend not to share test resources unless there's a benefit to it, just to keep things more independent

@AndreMiras AndreMiras deleted the feature/recipe_unit_tests branch February 5, 2019 15:51
@AndreMiras
Copy link
Member Author

Yes you both have good point 👍 It's often hard to balance between reusing, decoupling and readability.
Since it was just a little line of code this time I went for creating each time, but yes I could have used the setUp() method just like I did in tests/recipes/test_gevent.py.
Let's see as the boiler plate gets bigger and the number of tests increase maybe we will end up using setUp() here too

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.

3 participants