Python Testing Basics
Test Python code with pytest: fixtures, parametrization and mocks.
What you'll learn
- Write tests with pytest and assert
- Share setup with fixtures
- Parametrize tests
- Mock external calls
About this course
You add tests to a small Python package. You learn pytest structure, fixtures, parametrized tests, mocking and coverage.
Course curriculum
4 modules and 12 lessons over 3 weeks. Plan for about 9 learning hours.
01pytest basicsWeek 1 · 3 lessons
- Test discovery
- assert
- Running tests
02FixturesWeek 1 · 3 lessons
- Fixtures
- Scopes
- tmp_path
03PatternsWeek 2 · 3 lessons
- Parametrize
- Testing errors
- Mocks
04Tested packageWeek 3 · 3 lessons
- Adding tests
- Coverage
- CI run
Project
Tested package. A small Python package with pytest tests and a coverage report.
Who this course is for
Python developers who don't write tests yet.
Prerequisites
You write Python functions and modules.
What's included
- 120-day course access
- Step-by-step lessons
- Practice files
- Reusable code templates
- A graded final exercise
- A digital completion certificate
Learning format
Self-paced practical course, part of our self-paced courses. Graded final exercise with written feedback.
Access and delivery
- Enrollment is activated within 15 minutes after payment.
- Final exercise feedback is delivered within 2 business days of submission, and the completion certificate is issued within 2 business days after passing the final exercise.
Certificate
You receive a digital completion certificate. Final exercise feedback is delivered within 2 business days of submission, and the completion certificate is issued within 2 business days after passing the final exercise.
Frequently asked questions
When does access start?
Enrollment is activated within 15 minutes after payment.
Is payment taken on this website?
No. After you submit your enrollment request, we reply by email with payment details and enrollment confirmation.
Does this course guarantee a job or income?
No. It is an education and training service and does not include employment, income or placement guarantees.
Can I cancel?
Our Refund and Cancellation Policy lists the terms for self-paced course programs.