From 78ba8a7d43aa3715fcfc71b2c02e88f2c1ead6b3 Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio <123113322+carlos-villavicencio-adsk@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:31:57 -0500 Subject: [PATCH] SG-34462 Test CI with Python 3.11 (#50) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Python 3.11 POC * Add debug info * Use PySide6 for 3.11 only * Use Qt bindings * Use PySide6-Essentials bindings * Fix typo * PyQt6-Qt6 6.6.1 * Use PySide instead of Qt * Fix import * Install libegl1 * Sudo, make me a 🥪 * Uncomment previous tests * Supress deprecation warnings from pytest-nunit * Update code style validation versions * Remove fix version for pytest-nunit * Attempt * Revert * Fix attrs version for tk-framework-desktopserver * Undo fix attrs version for tk-framework-desktopserver --- azure-pipelines.yml | 5 ---- internal/code-style-validation.yml | 5 ++-- internal/run-tests-with.yml | 3 ++ internal/run-tests.yml | 44 ++++++++++++++++++++++++++++++ tests/test_build.py | 7 +++-- 5 files changed, 55 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d659fe2e..29cea9d7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,14 +28,9 @@ pr: variables: - group: deploy-secrets -# Invoke the build pipeline template with Qt.py has an extra dependency so -# the tests can run properly. jobs: - template: build-pipeline.yml parameters: - # There's a test inside this repo that requires Qt.py - extra_test_dependencies: - - Qt.py # This has the side effect that it ensures we can clone the UI automation # repo with the SSH key has_ui_tests: true diff --git a/internal/code-style-validation.yml b/internal/code-style-validation.yml index c30dd8a2..b6795a92 100644 --- a/internal/code-style-validation.yml +++ b/internal/code-style-validation.yml @@ -25,8 +25,8 @@ jobs: # Use Python 3 for validating the code. - task: UsePythonVersion@0 inputs: - versionSpec: '3.9' - displayName: Use Python 3.9 + versionSpec: '3.10' + displayName: Use Python 3.10 - template: pip-install-packages.yml parameters: @@ -44,5 +44,6 @@ jobs: - bash: pre-commit run --all displayName: Validate code + # Validate documentation with PySide2 and Python 3.10 - bash: tk-docs-preview --build-only --verbose displayName: Validate documentation diff --git a/internal/run-tests-with.yml b/internal/run-tests-with.yml index 33c2cff4..41314207 100644 --- a/internal/run-tests-with.yml +++ b/internal/run-tests-with.yml @@ -97,6 +97,9 @@ jobs: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo ">>> Started Xvfb" displayName: Start Xvfb + # Install libegl1 required for PySide6 + - bash: sudo apt install libegl1 + displayName: Install libegl1 # Repositories using our build pipeline outside of the # shotgunsoftware organization should not be able to run our UI automation diff --git a/internal/run-tests.yml b/internal/run-tests.yml index 574f674c..931a8869 100644 --- a/internal/run-tests.yml +++ b/internal/run-tests.yml @@ -190,3 +190,47 @@ jobs: tk_core_ref: ${{ parameters.tk_core_ref }} post_tests_steps: ${{ parameters.post_tests_steps }} has_unit_tests: ${{ parameters.has_unit_tests }} + + # ------------------------- + - template: run-tests-with.yml + parameters: + image_name: 'windows-2022' + python_version: 3.11 + qt_wrapper: PySide6==6.6.1 + job_name: "Windows" + # pass through all parameters + extra_test_dependencies: ${{ parameters.extra_test_dependencies }} + tk_toolchain_ref: ${{ parameters.tk_toolchain_ref }} + additional_repositories: ${{ parameters.additional_repositories }} + tk_core_ref: ${{ parameters.tk_core_ref }} + post_tests_steps: ${{ parameters.post_tests_steps }} + has_unit_tests: ${{ parameters.has_unit_tests }} + ui_automation_ref: ${{ parameters.ui_automation_ref }} + + - template: run-tests-with.yml + parameters: + image_name: 'macOS-12' + python_version: 3.11 + qt_wrapper: PySide6==6.6.1 + job_name: "macOS" + # pass through all parameters. + extra_test_dependencies: ${{ parameters.extra_test_dependencies }} + tk_toolchain_ref: ${{ parameters.tk_toolchain_ref }} + additional_repositories: ${{ parameters.additional_repositories }} + tk_core_ref: ${{ parameters.tk_core_ref }} + post_tests_steps: ${{ parameters.post_tests_steps }} + has_unit_tests: ${{ parameters.has_unit_tests }} + + - template: run-tests-with.yml + parameters: + image_name: 'ubuntu-22.04' + qt_wrapper: PySide6==6.6.1 + python_version: 3.11 + job_name: "Linux" + # pass through all parameters. + extra_test_dependencies: ${{ parameters.extra_test_dependencies }} + tk_toolchain_ref: ${{ parameters.tk_toolchain_ref }} + additional_repositories: ${{ parameters.additional_repositories }} + tk_core_ref: ${{ parameters.tk_core_ref }} + post_tests_steps: ${{ parameters.post_tests_steps }} + has_unit_tests: ${{ parameters.has_unit_tests }} diff --git a/tests/test_build.py b/tests/test_build.py index 27e9d369..ec2a8f34 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -10,8 +10,11 @@ import sys -# Qt.py should have been installed by the build pipeline. -from Qt import QtWidgets +# We don't have access to sgtk. Import directly from the environment. +try: + from PySide2 import QtWidgets # noqa +except ImportError: + from PySide6 import QtWidgets # noqa def test_qt():