Skip to content

Commit

Permalink
Merge pull request #201 from pnuu/debug-ci-failures
Browse files Browse the repository at this point in the history
Fix test failures
  • Loading branch information
pnuu committed Feb 29, 2024
2 parents aaf85a9 + a4ac1f5 commit dc4b933
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions trollflow2/tests/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ def setUp(self):
def test_run_does_not_call_process_directly(self):
"""Test that process is called through Process."""
from trollflow2.launcher import Runner
with mock.patch('trollflow2.launcher.yaml.load'),\
mock.patch('trollflow2.launcher.open'),\
mock.patch('trollflow2.launcher.generate_messages') as generate_messages,\
mock.patch('trollflow2.launcher.process') as process,\
mock.patch('trollflow2.launcher.check_results'),\
with mock.patch('trollflow2.launcher.yaml.load'), \
mock.patch('trollflow2.launcher.open'), \
mock.patch('trollflow2.launcher.generate_messages') as generate_messages, \
mock.patch('trollflow2.launcher.process') as process, \
mock.patch('trollflow2.launcher.check_results'), \
mock.patch('multiprocessing.get_context'):
generate_messages.side_effect = ['foo', KeyboardInterrupt]
prod_list = {'product_list': {}}
Expand All @@ -400,8 +400,8 @@ def test_run_does_not_call_process_directly(self):
def test_run_relies_on_listener(self):
"""Test running relies on listener."""
from trollflow2.launcher import Runner
with mock.patch('trollflow2.launcher.yaml.load') as yaml_load,\
mock.patch('trollflow2.launcher.open'),\
with mock.patch('trollflow2.launcher.yaml.load') as yaml_load, \
mock.patch('trollflow2.launcher.open'), \
mock.patch('multiprocessing.get_context') as get_context, \
mock.patch('trollflow2.launcher.ListenerContainer') as lc_:
msg = mock.MagicMock()
Expand All @@ -420,7 +420,7 @@ def test_run_relies_on_listener(self):
runner.run()
except KeyboardInterrupt:
pass
listener.output_queue.called_once()
listener.output_queue.get.assert_called_once()
lc_.assert_called_with(addresses=None, nameserver='localhost',
topics=['/topic1', '/topic2'])
# Subscriber topics are removed from config
Expand Down Expand Up @@ -451,9 +451,9 @@ def test_subprocess_is_spawned(self):
def run_on_a_simple_product_list(config):
"""Run a simple (fake) product list."""
from trollflow2.launcher import Runner
with mock.patch('trollflow2.launcher.yaml.load') as yaml_load,\
mock.patch('trollflow2.launcher.open'),\
mock.patch('multiprocessing.get_context') as get_context,\
with mock.patch('trollflow2.launcher.yaml.load') as yaml_load, \
mock.patch('trollflow2.launcher.open'), \
mock.patch('multiprocessing.get_context') as get_context, \
mock.patch('trollflow2.launcher.ListenerContainer') as lc_:

msg = mock.MagicMock()
Expand Down Expand Up @@ -486,8 +486,8 @@ def setUp(self):
def test_run_keyboard_interrupt(self):
"""Test interrupting the run with a ctrl-C."""
from trollflow2.launcher import Runner
with mock.patch('trollflow2.launcher.yaml.load'),\
mock.patch('trollflow2.launcher.open'),\
with mock.patch('trollflow2.launcher.yaml.load'), \
mock.patch('trollflow2.launcher.open'), \
mock.patch('trollflow2.launcher.ListenerContainer') as lc_:
listener = mock.MagicMock()
get = mock.Mock()
Expand Down

0 comments on commit dc4b933

Please sign in to comment.