SG-39209 New core patcher for PySide2 to look like PySide6 #1026
Build #20250624.1 had test failures
Details
- Failed: 57 (0.55%)
- Passed: 10,302 (99.36%)
- Other: 9 (0.09%)
- Total: 10,368
- 14999 of 22142 lines covered (67.74%)
Annotations
Check failure on line 1185 in Build log
azure-pipelines / tk-core
Build log #L1185
3 test(s) failed, 1152 test(s) collected.
Check failure on line 1483 in Build log
azure-pipelines / tk-core
Build log #L1483
Bash exited with code '1'.
Check failure on line 1245 in Build log
azure-pipelines / tk-core
Build log #L1245
14 test(s) failed, 1152 test(s) collected.
Check failure on line 2079 in Build log
azure-pipelines / tk-core
Build log #L2079
Bash exited with code '1'.
azure-pipelines / tk-core
tests/util_tests/test_qt_importer.py::QtImporterTests::test_qt_importer_with_pyside2_interface_qt5
self = <tests.util_tests.test_qt_importer.QtImporterTests testMethod=test_qt_importer_with_pyside2_interface_qt5>
@skip_if_pyside2(found=False)
def test_qt_importer_with_pyside2_interface_qt5(self):
"""
Test the QtImporter constructor with QT5 interface.
This test only runs if PySide2 is available.
"""
qt = qt_importer.QtImporter(qt_importer.QtImporter.QT5)
# Check that the qt modules were initialized
assert qt.QtCore
assert qt.QtGui
assert qt.QtNetwork
assert qt.shiboken
assert qt.shiboken.__name__ == "shiboken2"
> assert qt.QtWebEngineWidgets
E assert None
E + where None = <tank.util.qt_importer.QtImporter object at 0x7f18dcc0e6b0>.QtWebEngineWidgets
tests/util_tests/test_qt_importer.py:68: AssertionError
Raw output
/home/vsts/work/1/s/tests/util_tests/test_qt_importer.py:68: assert None
azure-pipelines / tk-core
tests/util_tests/test_qt_importer.py::QtImporterTests::test_skip_webengine_qt5
self = <tests.util_tests.test_qt_importer.QtImporterTests testMethod=test_skip_webengine_qt5>
mocks = (<MagicMock name='QtWebEngineWidgets' id='139744025002192'>,)
qt = <tank.util.qt_importer.QtImporter object at 0x7f18b0f85720>
@py_assert1 = None
@skip_if_pyside2(found=False)
@skip_if_pyside6(found=True)
@unittest.mock.patch(
# Ensure the QtWebEngineWidgets module is present
"PySide2.QtWebEngineWidgets"
)
@unittest.mock.patch.dict(
# Set the SHOTGUN_SKIP_QTWEBENGINEWIDGETS_IMPORT variable
"os.environ",
{"SHOTGUN_SKIP_QTWEBENGINEWIDGETS_IMPORT": "1"}
)
def test_skip_webengine_qt5(self, *mocks):
# Test default Qt interface (Qt4)
qt = qt_importer.QtImporter()
# Check that the qt modules were initialized
assert qt.QtCore
# Ensure the QtWebEngineWidgets module is NOT imported
assert qt.QtWebEngineWidgets is None
# Repeat the test with Qt5 interface
qt = qt_importer.QtImporter(
interface_version_requested=qt_importer.QtImporter.QT5,
)
# Check that the qt modules were initialized
assert qt.QtCore
# Ensure the QtWebEngineWidgets module is NOT imported
> with self.assertRaises(KeyError):
E AssertionError: KeyError not raised
tests/util_tests/test_qt_importer.py:150: AssertionError
Raw output
/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/unittest/case.py:163: AssertionError: KeyError not raised
azure-pipelines / tk-core
tests/authentication_tests/test_interactive_authentication.py::InteractiveTests::test_focus
self = <tests.authentication_tests.test_interactive_authentication.InteractiveTests testMethod=test_focus>
@suppress_generated_code_qt_warnings
def test_focus(self):
"""
Make sure that the site and user fields are disabled when doing session renewal
"""
> with self._login_dialog() as ld:
tests/authentication_tests/test_interactive_authentication.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.13/x64/lib/python3.11/contextlib.py:137: in __enter__
return next(self.gen)
tests/authentication_tests/test_interactive_authentication.py:116: in _login_dialog
with contextlib.closing(MyLoginDialog(is_session_renewal, **kwargs)) as ld:
python/tank/authentication/login_dialog.py:187: in __init__
self.ui.setupUi(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tank.authentication.ui.login_dialog.Ui_LoginDialog object at 0x7f2ff5825e10>
LoginDialog = <tests.authentication_tests.test_interactive_authentication.MyLoginDialog(0x55afa8586a70, name="LoginDialog") at 0x7f2ff6916d80>
def setupUi(self, LoginDialog):
if not LoginDialog.objectName():
LoginDialog.setObjectName(u"LoginDialog")
> LoginDialog.setWindowModality(Qt.NonModal)
E NameError: name 'Qt' is not defined
python/tank/authentication/ui/login_dialog.py:33: NameError
Raw output
/home/vsts/work/1/s/python/tank/authentication/ui/login_dialog.py:33: NameError: name 'Qt' is not defined
azure-pipelines / tk-core
tests/authentication_tests/test_web_login.py::WebLoginTests::test_web_login
self = <tests.authentication_tests.test_web_login.WebLoginTests testMethod=test_web_login>
def test_web_login(self):
from tank.authentication.ui import qt_abstraction
if not qt_abstraction.QtWebEngineWidgets:
self.skipTest("This tests requires QtWebEngineWidgets")
if qt_abstraction.QtWidgets.QApplication.instance() is None:
self._app = qt_abstraction.QtWidgets.QApplication([])
> obj = SsoSaml2Toolkit(
"Test Web Login",
qt_modules={
"QtCore": qt_abstraction.QtCore,
"QtGui": qt_abstraction.QtGui,
"QtNetwork": qt_abstraction.QtNetwork,
"QtWebEngineWidgets": qt_abstraction.QtWebEngineWidgets,
},
)
tests/authentication_tests/test_web_login.py:39:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python/tank/authentication/sso_saml2/sso_saml2.py:45: in __init__
self._core = SsoSaml2Core(window_title=window_title, qt_modules=qt_modules)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tank.authentication.sso_saml2.core.sso_saml2_core.SsoSaml2Core object at 0x7f18da7ffa60>
window_title = 'Test Web Login'
qt_modules = {'QtCore': <module 'PySide2.QtCore' from '/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/PySide2...dgets' from '/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/PySide2/QtWebEngineWidgets.abi3.so'>}
def __init__(self, window_title="Web Login", qt_modules=None):
"""
Create a Web login dialog, using a Web-browser like environment.
:param window_title: Title to use for the window.
:param qt_modules: a dictionnary of required Qt modules.
For Qt5/PySide2, we require modules QtCore, QtGui,
QtNetwork and QtWebEngineWidgets
:returns: The SsoSaml2Core oject.
"""
qt_modules = qt_modules or {}
self._logger = get_logger()
self._logger.debug("Constructing SSO dialog: %s", window_title)
self._developer_mode = False
if "SHOTGUN_SSO_DEVELOPER_ENABLED" in os.environ:
self._developer_mode = True
# pylint: disable=invalid-name
QtCore = self._QtCore = qt_modules.get("QtCore") # noqa
QtGui = self._QtGui = qt_modules.get("QtGui") # noqa
QtNetwork = self._QtNetwork = qt_modules.get("QtNetwork") # noqa
QtWidgets = self._QtWidgets = qt_modules.get("QtWidgets") # noqa
QtWebEngineWidgets = self._QtWebEngineWidgets = qt_modules.get(
"QtWebEngineWidgets"
) # noqa
QtWebEngineCore = self._QtWebEngineCore = qt_modules.get(
"QtWebEngineCore"
) # noqa
if QtCore is None:
raise SsoSaml2MissingQtCore("The QtCore module is unavailable")
if QtGui is None:
raise SsoSaml2MissingQtGui("The QtGui module is unavailable")
if QtNetwork is None:
raise SsoSaml2MissingQtNetwork("The QtNetwork module is unavailable")
if QtWebEngineWidgets is None:
raise SsoSaml2MissingQtWebEngineWidgets(
"The QtWebEngineWidgets module is unavailable"
)
# If PySide2 is being used, we need to make extra checks to ensure
# that needed components are indeed present.
#
# The versions of PySide2 are only lightly coupled with the versions
# of Qt it exposes. It is possible to mix-and-match a very recent Qt5
# and have a very old version of PySide2. The issue is that it does
# not necessarily expose to the Python layer all of the classes and
# methods needed for us to go forward with the Web-based authentication.
# At the time of this writing, there was these reported situations:
#
Raw output
/home/vsts/work/1/s/python/tank/authentication/sso_saml2/core/sso_saml2_core.py:219: AttributeError: 'NoneType' object has no attribute 'QWebEnginePage'