( self )
| 127 | c.get( "c++" ) |
| 128 | |
| 129 | def testElapsedTime( self ) : |
| 130 | |
| 131 | c = IECore.Canceller() |
| 132 | time.sleep( 0.1 ) |
| 133 | self.assertEqual( c.elapsedTime(), 0.0 ) |
| 134 | |
| 135 | c.cancel() |
| 136 | time.sleep( 0.25 ) |
| 137 | t = c.elapsedTime() |
| 138 | # Windows potentially sleeps less than the requested amount of time. |
| 139 | # Testing indicates 1 millisecond should be enough margin to pass. |
| 140 | self.assertGreaterEqual( t, 0.25 - 0.001 ) |
| 141 | # We'd like to `assertAlmostEqual( t, 0.25 )` as well, to check that are |
| 142 | # units are seconds. But the load on CI machines is sometimes such that |
| 143 | # we couldn't do that with any kind of reasonable epsilon. Instead, just |
| 144 | # check that the units are in the right ballpark. |
| 145 | self.assertLess( t, 2.0 ) |
| 146 | |
| 147 | # Calling `cancel()` again shouldn't reset elapsed time. |
| 148 | c.cancel() |
| 149 | self.assertGreaterEqual( c.elapsedTime(), t ) |
| 150 | |
| 151 | def testExceptionLifetime( self ) : |
| 152 |
nothing calls this directly
no test coverage detected