Skip to content

MNT: try running tests on pyside6 in github actions automated tests, expect these to fail terribly atm #1194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 40 additions & 28 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This workflow will install pydm dependencies and run the test suite for all combinations
# of operating systems and version numbers specified in the matrix

name: Build Status

on:
Expand All @@ -20,58 +19,71 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10']
pyqt-version: [5.12.3, 5.15.9]
python-version: ['3.10']
env:
DISPLAY: ':99.0'
QT_MAC_WANTS_LAYER: 1 # PyQT gui tests involving qtbot interaction on macOS will fail without this

steps:
- name: Install packages for testing a Python Qt app on Linux
shell: bash -el {0}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install -y xvfb herbstluftwm libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
sleep 3
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_herbstluftwm_99.pid --make-pidfile --background --exec /usr/bin/herbstluftwm
sleep 1
fi

- uses: actions/checkout@v4
- name: Setup conda
- name: Setup Conda and install PyQt5
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: pydm-env
activate-environment: pyqt-env
conda-remove-defaults: true
architecture: x64 # Ensure macOS finds PyQt 5.12.3 which isn't available with osx-arm64

- name: Install PyDM with Mamba
- name: Setup Conda and install PySide6
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: pyside-env
conda-remove-defaults: true
architecture: x64
auto-update-conda: true

- name: Install PySide6 and PyDM with Mamba (if windows use conda)
shell: bash -el {0}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
conda install -c conda-forge pydm pyqt=${{ matrix.pyqt-version }}
elif [ "$RUNNER_OS" == "macOS" ]; then
mamba install -c conda-forge pydm pyqt=${{ matrix.pyqt-version }} git p4p pyca
conda install -c conda-forge pyside6 pydm
else
mamba install -c conda-forge pydm pyqt=${{ matrix.pyqt-version }} pyca
mamba install -c conda-forge pyside6 pydm pyca
fi

- name: Install additional Python dependencies with pip
- name: Install additional Python dependencies with pip for PySide6
shell: bash -el {0}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
pip install .[test]
pip install -r requirements.txt
if [ "$RUNNER_OS" == "Windows" ]; then
pip install -r windows-dev-requirements.txt
else
pip install .[test-no-optional]
fi

- name: Install packages for testing a PyQt app on Linux
shell: bash -el {0}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install -y xvfb herbstluftwm libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
sleep 3
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_herbstluftwm_99.pid --make-pidfile --background --exec /usr/bin/herbstluftwm
sleep 1
pip install -r dev-requirements.txt
fi

- name: Test with pytest
- name: Run PySide6 tests with pytest
env:
QT_API: pyside6
shell: bash -el {0}
timeout-minutes: 30 # timeout applies to single run of run_tests.py, not all os/python combos
timeout-minutes: 30
run: |
echo "Running PySide6 tests with QT_API=$QT_API"
python -c "import PySide6.QtCore; print('PySide6 is installed and working')"
python run_tests.py
5 changes: 5 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import sys
import pytest
from pydm.utilities import ACTIVE_QT_WRAPPER, QtWrapperTypes

if __name__ == "__main__":
# Show output results from every test function
Expand All @@ -23,6 +24,10 @@
args.append("--ignore=pydm/tests/data_plugins/test_p4p_plugin_component.py")
args.append("--ignore=pydm/tests/data_plugins/test_psp_plugin_component.py")

if ACTIVE_QT_WRAPPER == QtWrapperTypes.PYSIDE6:
args.append("--ignore=pydm/tests/test_plugins_import.py")
args.append("--ignore=pydm/tests/test_main_window.py")

print("pytest arguments: {}".format(args))

sys.exit(pytest.main(args))
Loading