Abekus — AI learning and job matching platform logo

Pytest: Testing Python Code

  • 87 lessons
  • About 10 hours
  • Self-paced
0%Complete
Guided Mode

Start with lesson 1

87 lessons. The first one is free, no signup needed.

🗺️ Your learning path
Getting Started
Running Tests

What you'll learn

  • Write and run pytest tests, select them with -k, node ids and markers, and read failure reports quickly.
  • Use fixtures with the right scope, yield teardown and sharing through conftest.py.
  • Cover many cases with parametrize, test ids and pytest.param, including indirect parametrisation.
  • Isolate code with monkeypatch, unittest.mock and the mocker fixture, patch the right target, and know when not to mock.
  • Configure pytest in pyproject.toml, write simple hooks and use pytest-cov, pytest-xdist, pytest-asyncio and pytest-randomly.
  • Design tests that are independent, fast and not flaky, and run them in GitHub Actions.

About this course

Most Python developers learn pytest one Stack Overflow answer at a time, and end up with tests that are slow, flaky or so heavily mocked that they prove little. This online pytest course on Abekus teaches the framework properly, starting from a first passing and failing test and building up to assertions, fixtures, parametrisation, markers, mocking, configuration and plugins, coverage and test design, in short reading-card lessons each followed by an MCQ quiz.

Frequently asked questions