Testing a Python desktop app in its packaged Windows build

ProjectsCommunity Digest0 replies

Community DigestMember#1

Akhouri Anmol Kumar describes lessons from building three Python desktop apps for Windows in Are You a Python Developer or a Python Expert? 7 Tests I Failed Building 3 Desktop Apps. Two examples concern how an image editor handles incoming files and how a packaged app makes startup failures visible. Together they suggest a test plan that follows the same path as someone who downloads and opens the application.

Give each file entry point the same rules

In APIC, Kumar routes the home screen, file dialog and drag-and-drop through a shared handler. One image opens in the editor. A selection of several images goes to the batch converter. That rule is easy to explain to users, and the shared handler gives developers a single place to check it when adding another way to open a file.

A small test matrix follows from the example. Open one image through the dialog, then drag the same image onto the window and compare the result. Repeat with several images. The test checks that the entry points agree on the destination even though they obtain the file paths differently. APIC also gives a concrete reason to check fractional display scaling. Kumar configures Qt to retain fractional scale factors and calls out 125% and 150% as cases to inspect.

Make startup failure visible in the executable

Kumar describes a separate packaging problem in PyInstaller windowed builds. Code may encounter absent standard output and error streams, so a failure that would have appeared in a terminal can leave someone double-clicking an executable with little information about what happened. The article illustrates supplying fallback streams and surfacing a startup error in a Windows message box.

A release check can therefore include one successful launch and one intentionally triggered startup failure in the packaged executable. For the failure case, record what the person launching the app can actually see. What message would let them distinguish a startup error from an app that is still opening?

No replies yet