Unit Testing in Python

Details
The workshop is aimed at people who are familiar with Python
basics, and would like to improve their skills, by learning how
to write professional quality Python code.
Modifying Python code without unit test cases is like walking
through a field of landmines. Python's dynamic nature allows
typos in variable / attribute names, and incorrect indentation to
go unnoticed, until a specific input drives it through the
erroneous code path. Integration testing be it manual or
automated is insufficient and can at times be frustrating for
Python code.
Fortunately, Python's own standard library makes it easy to write
unit test cases, by providing the needed infrastructure. Through
this workshop, we would like to make a strong case for unit
testing, and then show how to use the available frameworks for
writing test cases. We will also cover how dependencies can be
isolated using mocking and faking. We then move beyond writing
test cases and cover reporting, code coverage and CI integration.
Prerequisite: Should be familiar with basic object-oriented programming
with Python.
Outline :
Introduction to Unit Testing
Need for Unit Testing in Python
Unit Testing Basics
Integration Testing vs Unit Testing
Getting Started
Unit Testing Framework
Writing Simple Unit Tests
Arrange - Act - Assert
Setup and Tear Down
Mocking and Patching
Isolating Dependencies with Mocks
How Mock Objects Works
Unit Testing with Mocks
Patching Internal Dependencies
How Patching Works
Unit Testing with Patching
Fixtures
Introduction
Sharing Setup Code
Releasing Resources
Managing Test Cases
Organizing Test Cases
Test Discovery
Test Reports
Code Coverage Reports
Integrating with CI
Pointers and Resources
Questions
Speaker Bio
Vijay is an embedded software developer and trainer by
profession. He conducts training in various topics related to
Embedded Systems, Linux and Python. As part of his work at his
current company, Zilogic Systems, he has helped several
companies, in the Chennai region, migrate their firmware based
embedded products to Linux. He also co-ordinates the activities
of Chennaipy. In the past 5 years, he has done over 50 talks at
Chennaipy. His work at Chennaipy was recognized by the PSSI, with
the Kenneth Gonsalves Award, for the year 2015.
He has made contributions to the Linux Kernel, U-Boot, Qemu and
the Linux Testing Project.
• What to bring
Laptop with python installed

Unit Testing in Python