diff --git a/tests/external_config/__init__.py b/tests/external_config/__init__.py index da346bb3..20dadf7c 100644 --- a/tests/external_config/__init__.py +++ b/tests/external_config/__init__.py @@ -99,7 +99,15 @@ def setUp(self): def tearDown(self): """ - Cleanup + Cleanup - release references before calling super().tearDown(). + + Setting instance variables to None releases references to Qt objects, + allowing them to be destroyed in a controlled order before the parent + tearDown runs. This prevents random segmentation faults during CI test + runs with PySide6 6.8.3+ where Qt signal auto-disconnection can access + freed memory during object destruction. """ + self.external_config_loader = None + self.bg_task_manager = None super().tearDown() diff --git a/tests/shotgun_model/test_cached_schema.py b/tests/shotgun_model/test_cached_schema.py index ebe6d60b..b152670e 100644 --- a/tests/shotgun_model/test_cached_schema.py +++ b/tests/shotgun_model/test_cached_schema.py @@ -8,6 +8,7 @@ # agreement to the Shotgun Pipeline Toolkit Source Code License. All rights # not expressly granted therein are reserved by Shotgun Software Inc. +import sys import time from unittest import mock @@ -138,11 +139,16 @@ def _trigger_cache_load(self): # The schema is loaded by a background thread, so we'll have to process events so the results can more in. before = time.time() + + timeout = 5 if sys.version_info >= (3, 13) else 2 + # Python 3.13+ has different threading/GIL behavior that can make background + # tasks slower on some platforms (especially macOS). + while ( self._cached_schema._is_schema_loaded() is False or self._cached_schema._is_status_loaded() is False ): self._qapp.processEvents() assert ( - before + 2 > time.time() + before + timeout > time.time() ), "Timeout, schema shouldn't take this long to load from Mockgun."