Professional Testing with Python

Course Data

Course name: Professional Testing with Python Course length: 3 days Remote: Yes Open course: Yes In-house: Yes Course ID: PTE Price: See registration link German course

here

———
Course Dates

LocationDateRegistration

Leipzig

March 09 - 11, 2027

here

Remote

March 09 - 11, 2027

here

LanguageEnglish

———
Course Finder

Find the right course for your needs..

What Participants Say About This Course

I think overall the course was held excellently. I learnt a lot and learnt how to use the different techniques and ideas.

—Vinay Mathew, course participant

Great opportunity to learn directly from the author of py.test.

—a course participant

Impressive & abundant, clear information. It’s been a privilege!

—a course participant

Target Audience

People with a Python programming background, interested in best practices of testing Python libraries and applications. This course can be combined with introductory courses (see

Recommended Module Combinations

) to achieve appropriate Python skills.

Motivation

Testing is essential for code quality. Tests need to be automated and regularly run to benefit from them. Frameworks such as

pytest

are based on many years of exercise and help you apply best practices to your tests. Apart from integrating with existing unittest/nose test suites, pytest offers some unique features for writing and organizing your test code.

Testing and releasing your code for many different Python versions and implementations can be hard. The

tox

project is an effective tool to integrate testing and deployment. It works with and connects to established tools including those for Continuous Integration.

Applying the Python philosophy that simple things should be simple and complex tasks should be possible,

pytest

and

tox

make it easy to get started but at the same time provide powerful features for professional software development.

Course Content

In distinct steps we introduce terms and tools for testing in Python. Each step consists of an input, discussion and self-practice phase.

The main topics of the course are:

About testing: Why and how to write tests

About pytest: Why pytest, popularity, history overview

The basics: Fundamental pytest features, test discovery and plain asserts

Configuration: Typical directory structure, configs, options

Marks: Marking/grouping tests, skipping tests

Parametrization: Running tests against sets of input/output data

Fixtures: Providing test data, setting up objects, modularity

Built-in fixtures: Temporary files, patching, capturing output, test information

Fixtures advanced: Caching, cleanup/teardown, implicit fixtures, parametrizing

Migrating to pytest: Running existing testsuites, incremental rewriting, tooling

Debugging failing tests: Controlling output, selecting tests, tracing fixtures, using breakpoints, showing durations, dealing with hanging and flaky tests

Mocking: Dealing with dependencies which are in our way, alternatives, monkeypatch and unittest.mock, mocking libraries and helpers

Plugin tour: Coverage, domain specific languages, test reporting, alternative test syntax, testing C libraries, plugin overview

Property-based testing: Using hypothesis to generate test data

Writing plugins: Extending pytest via custom hooks

Open space: Discussions of your choice, postponed issues from the course

Optional

tox basics: Packaging, running tests against different Python versions

tox configuration: Defining environments

tox extra: Running tools via tox, integrating into Continuous Integration (CI)

Each bullet point will be covered with two to three short units with exercises.

Course Style

This is a hands-on course with lots of student activities. The presentation parts are usually short and include real-life examples. Students will create their own tests from the very beginning. Exercises are an important part of the training. Students are encouraged to bring their own problems to be discussed during the course.

Exercises

The participants can follow all steps directly on their computers. There are exercises at the end of each unit providing ample opportunity to apply the freshly learned knowledge.

Software

We use our online programing system that contains all needed software. There is no need to install any additional software. A modern internet browser and a decent internet connection will be enough.

Hardware for Open In-Person Trainings

For open trainings at our teaching center you can use your own laptop. Alternatively, we provide teaching computers. Please let us know if you need one in your registration form.

Course Material

Every participant receives comprehensive materials in PDF format that cover the whole course content as well as all source code.

Recommended Module Combinations

You should have intermediate Python experience or attend the course

Python for Programmers

before. You might be also interested in the course

Advanced Python

.