Skip to content

Qt

Preventing segfaults in test suite that has Qt Tests

[Updated 2029.10.09 with information about "Detect leaked widgets"]

Motivation

When providing a GUI application one needs to select a GUI backend. If it is a Python application that needs to work on all popular OSes1, Qt is a good choice. It is a cross-platform GUI toolkit that has good python bindings2.

However, Qt objects require special care during testing. In this post I will describe my experience of writing such tests based on my work on PartSeg and napari.