go back  39 - Writing Tests With Pytest




This challenge write-up first appeared on PyBites.

Life is about facing new challenges - Kostya Tszyu

Hi Pythonistas, let's add some more challenges for October. Following our Python testing with pytest book review we let you write some tests with this awesome framework.

The Challenge

Here are some options:

  1. Add tests for one of your repos that lacks tests. You can use BetterCodeHub to see how badly a project needs tests.

  2. Use pytest to add tests for a simple Flask API, code here.

  3. As mentioned in Talk Python #132: Contributing to open source, testing and documentation are great ways to contribute to open source. So like option 1. you could add tests to an open source project you like. Not only does this improve your understanding of the code, you also get to give something back, learning pytest as you go. Besides, as stated in challenge #38: this month any PR also counts towards Hacktoberfest.

Any tests will do, the purpose of this challenge is to get your feet wet with pytest. However you probably get the most out of this challenge if you play a bit with fixtures and other features/use cases.

Bonus

Credit

To get credit PR your work to our Community branch of our Challenges repo. See detailed instructions here.

About

Our goal is to learn and teach you Python through practical exercises. Learning a programming language is way more fun as a community!

For any feedback, issues or ideas use GH Issues, tweet us or drop us an email.


Keep Calm and Code in Python!

-- PyBites