Exercises

  1. Download the project for this chapter, tasks_proj, from the book’s webpage[7] and make sure you can install it locally with pip install /path/to/tasks_proj.
  2. Explore the tests directory.
  3. Run pytest with a single file.
  4. Run pytest against a single directory, such as tasks_proj/tests/func. Use pytest to run tests individually as well as a directory full at a time. There are some failing tests there. Do you understand why they fail?
  5. Add xfail or skip markers to the failing tests until you can run pytest from the tests directory with no arguments and no failures.
  6. We don’t have any tests for tasks.count() yet, among other functions. Pick an untested API function and think of which test cases we need to have to make sure it works correctly.
  7. What happens if you try to add a task with the id already set? There are some missing exception tests in test_api_exceptions.py. See if you can fill in the missing exceptions. (It’s okay to look at api.py for this exercise.)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.191.86