diff --git a/sdks/python/apache_beam/runners/interactive/interactive_beam_test.py b/sdks/python/apache_beam/runners/interactive/interactive_beam_test.py index af3f6638fc91..2fa10fc4aa44 100644 --- a/sdks/python/apache_beam/runners/interactive/interactive_beam_test.py +++ b/sdks/python/apache_beam/runners/interactive/interactive_beam_test.py @@ -886,8 +886,8 @@ def test_compute_dependency_wait_false(self, mock_is_computing): def test_async_computation_result_cancel(self): p = beam.Pipeline(ir.InteractiveRunner()) - # A stream that never finishes to test cancellation - pcoll = p | beam.Create([1]) | beam.Map(lambda x: time.sleep(100)) + # A slow transform to test cancellation while the computation is in flight + pcoll = p | beam.Create([1]) | beam.Map(lambda x: time.sleep(3)) ib.watch(locals()) self.env.track_user_pipelines() @@ -909,6 +909,7 @@ def test_async_computation_result_cancel(self): # This part is hard to test without deeper runner integration with self.assertRaises(TimeoutError): async_result.result(timeout=1) # It should not complete successfully + async_result.wait_for_completion(timeout=30) @patch( 'apache_beam.runners.interactive.recording_manager.RecordingManager.'