|
43 | 43 | from apache_beam.runners.interactive.dataproc.types import ClusterMetadata |
44 | 44 | from apache_beam.runners.interactive.testing.mock_env import isolated_env |
45 | 45 | from apache_beam.runners.portability.flink_runner import FlinkRunner |
| 46 | +from apache_beam.runners.runner import PipelineRunner |
46 | 47 | from apache_beam.testing.test_stream import TestStream |
47 | 48 | from apache_beam.transforms.window import GlobalWindow |
48 | 49 | from apache_beam.transforms.window import IntervalWindow |
@@ -532,6 +533,25 @@ def test_defaults_to_efficient_cache(self): |
532 | 533 | # Despite (highly redundant) windowing information, the cache is small. |
533 | 534 | self.assertLess(size, sum(inputs)) |
534 | 535 |
|
| 536 | + def test_default_pickle_library_override_delegates(self): |
| 537 | + mock_underlying = unittest.mock.MagicMock(spec=PipelineRunner) |
| 538 | + mock_underlying.default_pickle_library_override.return_value = 'cloudpickle' |
| 539 | + |
| 540 | + runner = interactive_runner.InteractiveRunner( |
| 541 | + underlying_runner=mock_underlying) |
| 542 | + |
| 543 | + self.assertEqual(runner.default_pickle_library_override(), 'cloudpickle') |
| 544 | + |
| 545 | + def test_default_pickle_library_override_fallback(self): |
| 546 | + mock_underlying = unittest.mock.MagicMock(spec=PipelineRunner) |
| 547 | + del mock_underlying.default_pickle_library_override |
| 548 | + |
| 549 | + runner = interactive_runner.InteractiveRunner( |
| 550 | + underlying_runner=mock_underlying) |
| 551 | + |
| 552 | + # Should fallback to the base class implementation without crashing |
| 553 | + self.assertIsNone(runner.default_pickle_library_override()) |
| 554 | + |
535 | 555 |
|
536 | 556 | @unittest.skipIf( |
537 | 557 | not ie.current_env().is_interactive_ready, |
|
0 commit comments