Automating PySide applications on MacOS

Last edited on

Overview

When testing a PySide Application with Squish it can be useful to test the Application from its Python script, as this will allow you to make simple changes to the PySide App without having to rebuild an application binary to test it again.

For this you select the Python that has the PySide library loaded as your AUT and provide the path to the script as an argument.

This will usually lead to the Hookup failing with the Script Error RuntimeError: startApplication() failed: AUT startup timed out after 20000ms

Reason

The reason for this can be found in the Runner/Server Log :

Loading Qt failed: dlopen(QtCore.framework/QtCore, 0x0001): tried: '/Library/Frameworks/Python.framework/Versions/Current/lib/pythonMAJOR.MINOR/site-packages/PySide6/Qt/lib/QtCore.framework/QtCore' (no such file), 'QtCore.framework/QtCore' (no such file), '/System/Volumes/Preboot/Cryptexes/OSQtCore.framework/QtCore' (no such file), '/usr/lib/QtCore.framework/QtCore' (no such file, not in dyld cache), 'QtCore.framework/QtCore' (no such file)

This error explains that loading Qt failed because QtCore in QtCore.framework could not be found.

What this is about is the QtCore symbolic link in the first level of the QtCore.framework folder. Because the PyPi index does not allow symlinks in packages, those are not present in the Qt libraries from the Qt Essentials package. But Squish relies on those symlinks to find the actual QtCore Mach-O library.

Solution

Create the symbolic links again by running the following commands in the QtCore.framework folder from a shell

ln -s ./Versions/A ./Versions/Current
ln -s ./Versions/Current/QtCore  ./QtCore

After this the error should no longer occur.