From 5843546e65e6efb35dfb81c66746ef765317ae54 Mon Sep 17 00:00:00 2001 From: ivanimanishi Date: Thu, 31 Oct 2024 10:05:44 -0700 Subject: [PATCH] GafferUITest : Fix `assertNodeUIsHaveExpectedLifetime()` test This test was raising an exception for nodes that are supposed to be "invisible", and therefore had no `NodeGadget`. --- Changes.md | 1 + python/GafferUITest/TestCase.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Changes.md b/Changes.md index cf47c8b5ae6..ff136283d3d 100644 --- a/Changes.md +++ b/Changes.md @@ -10,6 +10,7 @@ Fixes ----- - Render, InteractiveRender : Added default node name arguments to the compatibility shims for removed subclasses such as ArnoldRender. +- GafferUITest : Fixed `assertNodeUIsHaveExpectedLifetime()` test for invisible nodes. 1.5.0.1 (relative to 1.5.0.0) ======= diff --git a/python/GafferUITest/TestCase.py b/python/GafferUITest/TestCase.py index 46e02a51c34..523ebb02301 100644 --- a/python/GafferUITest/TestCase.py +++ b/python/GafferUITest/TestCase.py @@ -169,11 +169,13 @@ def assertNodeUIsHaveExpectedLifetime( self, module ) : weakScript = weakref.ref( script ) nodeGadget = GafferUI.NodeGadget.create( script["node"] ) - weakNodeGadget = weakref.ref( nodeGadget ) + if nodeGadget : + weakNodeGadget = weakref.ref( nodeGadget ) + del nodeGadget + self.assertIsNone( weakNodeGadget() ) - del window, nodeUI, nodeGadget + del window, nodeUI self.assertIsNone( weakNodeUI() ) - self.assertIsNone( weakNodeGadget() ) del script self.assertIsNone( weakScript() )