Contribute Media
A thank you to everyone who has made this possible: Read More

Testing is Fun in Python!


Testing software is just as important in Python as it is in any other programming language. Rather than treat testing as a “necessary evil,” Python offers a number of versatile test frameworks to make it fun and easy. This talk will cover basic testing best practices and introduce a few of the popular frameworks, including unittest, doctest, py.test, Nose, and Avocado.

Testing is vital to the success of any software, including big data and analytics code. Unfortunately, it is often regarded as a “necessary evil” – extra work that slows down progress. In this session, I will highlight how testing in Python can be fun, easy, fast, and helpful.

First, I will give a brief overview of basic best practices for testing. We will talk about the difference between debugging and testing, different types of tests, how to write good test cases, and basic testing fixtures like assertions and results. I will focus on unit testing, but the concepts can be applied to higher levels of testing as well.

Then, for the majority of the session, I will introduce different Python test frameworks: - unittest as the standard module for unit test classes. - doctest as a lightweight way to write short, self- documenting assertions in docstrings. - py.test as a way to write very concise test cases. - Nose as an extension of unittest with added features. - Avocado as a comprehensive framework with parameters, replay, and test discovery.

This talk is designed to be useful to Python programmers of any skill level. Only a basic understanding of Python is required.


Improve this page