Skip to content

Commit 9c532f2

Browse files
authored
Add Azure Pipelines instructions for running pytest-qt tests with PyQt6 to documentation (#591)
1 parent 26b05ba commit 9c532f2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/troubleshooting.rst

+26
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,32 @@ And here is a working Qt6 GitLab CI/CD config :
123123
- python -m pytest test.py
124124
125125
126+
And here is a working Qt6 Azure Pipelines CI/CD config for ``ubuntu-latest`` :
127+
128+
.. code-block:: yaml
129+
130+
# Set these environment variables for the job that runs tests
131+
132+
variables:
133+
DISPLAY: ':99.0' # This is needed for pytest-qt not to crash as mentioned above
134+
# Python fault handler is enabled in case UI tests crash without meaningful error messages
135+
PYTHONFAULTHANDLER: 'enabled' # https://docs.python.org/3/library/faulthandler.html
136+
137+
# Add this step to your CI pipeline before running your pytest-qt-based Qt6 tests with pytest
138+
139+
# this was tested with ``ubuntu-latest`` image
140+
- script: |
141+
sudo apt update
142+
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libxcb-shape0 libglib2.0-0 libgl1-mesa-dev
143+
sudo apt-get install -y '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
144+
sudo apt-get install -y x11-utils
145+
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX
146+
displayName: 'Install and start xvfb and other dependencies on Linux for Qt GUI tests'
147+
condition: and(succeededOrFailed(), eq(variables['Agent.OS'], 'Linux'))
148+
149+
# After this step, assuming you have ``pytest-qt`` installed, just run ``pytest`` and your PyQt6 tests will work
150+
151+
126152
``tlambert03/setup-qt-libs``
127153
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128154
Instead manually curate list of used packages you may use ``tlambert03/setup-qt-libs`` github action: https://github.com/tlambert03/setup-qt-libs

0 commit comments

Comments
 (0)