Mighty globals vs. your test suite

How covert globals break your tests (or application) and how to avoid them

Wolfgang Ulmer

Best Practice Debugging Test Libraries (pytest/nose/...) Testing failures/mistakes

Long Abstract:

Setting up tests in Python is super easy, thanks to powerful and great testing frameworks like pytest.
However maintaining thousands of tests can quickly become tough if your tests aren't robust against covert global states.
Covert global states are different from normal "global" Python variables as they aren't apparently visible. This makes it hard to identify them as source for trouble if you are experiencing test case failures which seem to be non-deterministic.
Discussions like "works on my computer" between developers are often the tip of the iceberg if you start to trace down the cause of the test case failure.

This talk will first introduce some real-life examples of covert globals, like file system access, log files, config files, preference files, deployment states, random number generators, memory allocation, etc.
Then, an overview will be given of the different types of covert globals.
Finally, existing tools or practices will be presented for avoiding test case failures and countering those mighty globals.

* Understand that there are more global states than just "global" Python variables
* Learn how to detect them
* Learn how to counter them

* Basic Python knowledge
* Some experience with setting up tests
* Basic operating system knowledge
* Experience with pytest, numpy, setuptools and integrating third-party tools is helpful

Type: Talk (30 mins); Python level: Beginner; Domain level: Intermediate

Wolfgang Ulmer

First experience with Python around 20 years ago, working with Python intensively since 10 years.
Working in research for Bosch.com as software developer, focus on continuous integration, testing, quality.