diff --git a/Changes.md b/Changes.md index 9f31a75ef8..eb86d7e2f5 100644 --- a/Changes.md +++ b/Changes.md @@ -18,6 +18,7 @@ Fixes - Fixed bug where the value dragged from the visualiser would be slightly different from the initial value on button press. (#6191) - Fixed error when trying to visualise data unsupported data. - TweakPlug : Fixed preservation of geometric interpretation when tweaking V3f values. +- ApplicationTest : Extended grace period when testing process name on slower hosts. API --- diff --git a/python/GafferTest/ApplicationTest.py b/python/GafferTest/ApplicationTest.py index 65c1974832..46563dcc83 100644 --- a/python/GafferTest/ApplicationTest.py +++ b/python/GafferTest/ApplicationTest.py @@ -64,13 +64,29 @@ def testWrapperDoesntDuplicatePaths( self ) : def testProcessName( self ) : process = subprocess.Popen( [ str( Gaffer.executablePath() ), "env", "sleep", "100" ] ) - time.sleep( 1 ) - command = subprocess.check_output( [ "ps", "-p", str( process.pid ), "-o", "command=" ], universal_newlines = True ).strip() - name = subprocess.check_output( [ "ps", "-p", str( process.pid ), "-o", "comm=" ], universal_newlines = True ).strip() - process.kill() + try : + startTime = time.time() + while True : + time.sleep( 0.1 ) + command = subprocess.check_output( [ "ps", "-p", str( process.pid ), "-o", "command=" ], universal_newlines = True ).strip() + name = subprocess.check_output( [ "ps", "-p", str( process.pid ), "-o", "comm=" ], universal_newlines = True ).strip() + try : + self.assertEqual( command, "gaffer env sleep 100" ) + self.assertEqual( name, "gaffer" ) + + except self.failureException : + # It can take some time for gaffer to change its own process name, which varies + # based on the host's performance. + # For that reason, we check until 3 seconds have passed before giving up. + if time.time() - startTime > 3.0 : + raise + + else : + break + + finally : + process.kill() - self.assertEqual( command, "gaffer env sleep 100" ) - self.assertEqual( name, "gaffer" ) if __name__ == "__main__": unittest.main()