Skip to content

alfredodeza/python-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Testing in Python

Python Bootcamp for Data week 3: Testing in Python with Pytest

This week, you will learn the basics of Python testing. From a brief overview of the standard library to using a more modern approach with Pytest, one of the most popular testing libraries in Python. By the end of this week, you should be comfortable working with existing tests, creating new tests, and debugging test failures.

🎥 Click the image below to access week 3 of the full course on O'Reilly

O'Reilly

This is week 3 (out of 4) of the Python Bootcamp for Data. The whole course has four weeks:

Table of Contents

Week 3 Content

  1. Testing Conventions
  2. Testing with Python
  3. Test Classes and parametrizing
  4. Failure output and Fixtures

Learning Objectives

In this week you will learn to:

  • Understand the basics of testing and its importance
  • Write and run tests with functions and classes
  • Use Pytest for running and creating tests

Excuses

If you are wondering about why test at all, first you should know about some common excuses:

It takes too much time

It isn't that it takes too much time, but it does take time. What takes more time than testing is debugging what went wrong and ensuring nothing broke with the latest change.

It is too difficult

Like almost anything, it takes practice to make progress. Take the time to understand what makes a good test, and why slow tests aren't that good. It is better to know that a window in your house is broken than a test that tells you that your house has some undefined problem somehwere.

We don't have bugs

Eventually, all software has bugs. And it is better to fix a bug once, not twice. A test will help you understand what and how it broke, and give you confidence on the fix.

Why test at all

If it doesn't work, who do we blame? The customer?

If you are releasing software, do you wait until a user finds a problem? The idea of testing is primarily to increase confidence.

Software tends to grow, dependencies change, and almost all engineers will forget about some crucial part of their software at some point. If you are making sure that a change is doing what is supposed to be doing, imagine having 30 steps to verify it all works.

You will miss a step if you need 30 steps to verify everything works.

Useful Resources

About

Python Bootcamp for Data week 3: Testing in Python with Pytest

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published