facebookarchive / sparts

Prototype python services with as little code as possible
Other
296 stars 44 forks source link

test_tornado's test_execute_async flaky #105

Open chantra opened 8 years ago

chantra commented 8 years ago

It seems this test may be flaky given that it succeeded on all other python flavors. https://travis-ci.org/facebook/sparts/jobs/119671018

tests/tasks/test_settaskoption.py ..
tests/tasks/test_tornado.py .
=================================== FAILURES ===================================
________________________ TestMyTask.test_execute_async _________________________
self = <tests.tasks.test_periodic.TestMyTask testMethod=test_execute_async>
    def test_execute_async(self):
        f = self.task.execute_async()
        res = f.result(3.0)
        self.assertNotNone(res)
        self.assertGreater(res, 0)

        # Verify exception path
        self.task.fail_async = True
        with self.assertRaises(Exception) as ctx:
            # Call this twice, since there's a race condition where setting
            # fail_async and getting the future from execute_async is called
            # when execute is between the self.fail_async check and the return
            self.task.execute_async().result(1.0)
>           self.task.execute_async().result(1.0)
E           AssertionError: Exception not raised
tests/tasks/test_periodic.py:60: AssertionError