From the course: Create an Open-Source Project in Python

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Writing simple tests

Writing simple tests

- To create a test file in our app, we'll use the touch command Usually in a more complex project it's good practice to place our source code and our test files in separate folders. But since this is a very small project with only one source code file we are going to leave the pytest of py file in the same directory and write all our tests in it. So let's open our test py file and start writing our tests. First we need to import our script so that we can use the objects and functions created there. So I import the reminders app and from the reminder we import tasks. (typing) Then we read our first test functions to test define task function. The convention is to name the test function by adding test in front of the function name. Let's omit underscore at the beginning. So it is test find task. Now we need a dummy task list to test with. So we defined a task list to be a list of task items. We have two items to…

Contents