Getting started with pytest Transcripts
Chapter: Test Functions
Lecture: Introducing test functions
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Welcome to Chapter two. We're gonna talk about test functions in this chapter.
0:05
We'll start by downloading and installing the course materials and pytest for the course.
0:11
The course materials are in the github repository which will clone and we will create a virtual environment with which to do the rest of the work.
0:20
We'll install cards locally. The cards source is part of the repository that will clone and we'll install pytest from pypi.org.
0:29
We'll next go through a demo. We'll make sure both cards and pytest are working properly. We'll play with cards a little bit.
0:35
So you understand the application that will be testing and we'll write a couple of tests both passing and failing. Just mostly to see how pytest works.
0:45
But then we'll jump into learning more about Pytest. We'll learn about test discovery, which is how pytest finds our test code.
0:52
We'll look at how we determine pass or fail. Within a test we use assert and we can also use pytest.fail.
1:00
And really any exception can cause a test to fail, especially when we have asserts. Pytest will put in place 'Enhanced tracebacks'.
1:10
to make it a little easier for us to determine what's wrong. Well look at test structure. This is how we structure test code to make it
1:18
easy to maintain and also easier to write. Also take a look at test classes which are one way to help structure our test functions.