Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Pytest + AI: Build a Full Test Suite with Claude Code
New
1 students

Pytest + AI: Build a Full Test Suite with Claude Code

Go from zero tests to 100% coverage on a real Python app, with Claude Code as your pair programmer
Last updated 11/2026
English

What you'll learn

  • Set up pytest and Claude Code on a real project, from an empty tests folder
  • Write clear tests with fixtures, factory fixtures and shared conftest files
  • Cover many cases at once with pytest.mark.parametrize
  • Test exceptions, dates and edge cases that humans usually miss
  • Mock network calls so your tests never touch the internet
  • Test file-based code with tmp_path
  • Use coverage reports to find what is still untested, and close the gaps with AI
  • Review AI-written tests critically, and prove real bugs with failing tests

Course content

6 sections • 21 lectures • 1h 30m total length
  • Welcome: what you'll build2:30
  • Setup: venv, pytest and Claude Code4:19
  • A tour of shopcart4:34

Requirements

  • Basic Python (functions, classes, imports)
  • Python 3.10+ installed
  • A Claude plan that includes Claude Code (Pro or higher), or watch along without it

Description

This course contains the use of artificial intelligence: the slides and visuals were created with AI help. The narration is the instructor's real voice, and every terminal session is real.

Build a professional pytest suite for a real Python app with Claude Code as your pair programmer, from zero tests to 100% line and branch coverage. Most Python projects have too few tests: writing them by hand is slow, so it gets skipped, and bugs reach production that a ten-line test would have caught. In this course you will fix that in one sitting.

You start with shopcart, a small but realistic e-commerce app with zero tests: a cart, coupons, sales tax, inventory, currency conversion from a web API, and CSV product imports. Together with Claude Code, you will build a professional pytest suite for it, with 100% line and branch coverage. The session recorded in this course ends with 296 tests. Your numbers will differ, because AI answers vary.

Each module teaches a core pytest skill. Fixtures and a shared conftest file keep your setup in one place. parametrize turns one test into a dozen cases. pytest.raises checks that errors happen when they should. Mocks and monkeypatch keep your tests away from the network, and tmp_path lets you test code that reads files. Finally, pytest-cov shows you exactly which lines are still untested.

You won't just accept whatever the AI writes. You will learn how to prompt for good tests, how to review them line by line, and how to spot tests that pass but prove nothing. Along the way, your new tests prove a planted expiry bug and expose real bugs nobody planted, in the cart, the inventory, the currency client and the CSV importer.

Every lecture is hands-on. You get the starter project, the finished solution, and a Claude memory file with testing rules you can reuse in your own projects.

This course contains the use of artificial intelligence.

Who this course is for:

  • Python developers who know they should write tests but never get to it
  • Developers who use AI for code but not yet for testing
  • QA engineers moving into Python test automation