Getting started with pytest Transcripts
Chapter: pytest Fixtures
Lecture: Naive fix for test order dependency
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
So with test Mod scope fail. The problem was that the database was not empty between empty between the data the two test calls.
0:11
So just to verify that this test fails account equals. Yeah, the count is one at the second test test empty because we added
0:22
an item in this first test and we haven't cleared it out. Let's go ahead and copy everything in this file and make a fix for it.
0:30
So the easy fix for this is because we are assuming that the cards database is
0:35
empty but it's not before we do anything within each test we can go ahead and make sure that we do a cards DB delete all and we'll do that in both
0:49
tests. Give me an empty database. Delete all when count is called. We don't need that here but let's just put it
0:57
in there anyway when count is called then count returns zero. So let's see if that fixes it.
1:08
So that fixes it. We haven't really been given an empty database, for deleting here so lets come up with another fix for this.