Skip to content

Commit a084cfe

Browse files
committed
Fix worker tests: mock _parse_ess_error for mockter adapter
MockAdapter writes YAML output (not real ESS logs), so determine_ess_status falsely reports convergence failure. Patching _parse_ess_error to return None in TestRunTask and TestWorkerLoop skips the ESS check for these mockter-based tests.
1 parent 555dca0 commit a084cfe

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

arc/scripts/pipe_worker_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import tempfile
1212
import time
1313
import unittest
14+
from unittest.mock import patch
1415

1516
from arc.job.pipe.pipe_state import (
1617
TaskState,
@@ -96,6 +97,11 @@ class TestRunTask(unittest.TestCase):
9697

9798
def setUp(self):
9899
self.tmpdir = tempfile.mkdtemp(prefix='pipe_run_test_')
100+
# MockAdapter's output.yml is not a real ESS log, so _parse_ess_error
101+
# would falsely report convergence failure. Skip it for these tests.
102+
patcher = patch('arc.scripts.pipe_worker._parse_ess_error', return_value=None)
103+
patcher.start()
104+
self.addCleanup(patcher.stop)
99105

100106
def tearDown(self):
101107
shutil.rmtree(self.tmpdir, ignore_errors=True)
@@ -308,6 +314,9 @@ class TestWorkerLoop(unittest.TestCase):
308314

309315
def setUp(self):
310316
self.tmpdir = tempfile.mkdtemp(prefix='pipe_loop_test_')
317+
patcher = patch('arc.scripts.pipe_worker._parse_ess_error', return_value=None)
318+
patcher.start()
319+
self.addCleanup(patcher.stop)
311320

312321
def tearDown(self):
313322
shutil.rmtree(self.tmpdir, ignore_errors=True)

0 commit comments

Comments
 (0)