Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions longbow/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ def launcher():

LOG.error(err)

exit(1)

# Show nice exit message.
finally:

Expand Down
25 changes: 17 additions & 8 deletions tests/unit/entrypoints/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"""

import os
import pytest

try:

Expand Down Expand Up @@ -245,12 +246,14 @@ def test_main_test5(m_isfile, m_update, m_recovery, m_longbow):
"--log", "new-log.file", "--verbose"]

with mock.patch('sys.argv', args):

launcher()
with pytest.raises(SystemExit) as err:
launcher()

assert m_longbow.call_count == 0
assert m_recovery.call_count == 0
assert m_update.call_count == 0
assert err.type == SystemExit
assert err.value.code == 1


@mock.patch('longbow.entrypoints.longbow')
Expand All @@ -270,8 +273,8 @@ def test_main_test6(m_isfile, m_longbowmain):
m_longbowmain.side_effect = exceptions.PluginattributeError

with mock.patch('sys.argv', args):

launcher()
with pytest.raises(SystemExit) as err:
launcher()

params = m_longbowmain.call_args[0][1]

Expand All @@ -289,6 +292,8 @@ def test_main_test6(m_isfile, m_longbowmain):
assert params["resource"] == "big-machine"
assert params["replicates"] == ""
assert params["verbose"] is False
assert err.type == SystemExit
assert err.value.code == 1


@mock.patch('longbow.entrypoints.longbow')
Expand All @@ -308,8 +313,8 @@ def test_main_test7(m_isfile, m_longbowmain):
m_longbowmain.side_effect = exceptions.PluginattributeError

with mock.patch('sys.argv', args):

launcher()
with pytest.raises(SystemExit) as err:
launcher()

params = m_longbowmain.call_args[0][1]

Expand All @@ -327,6 +332,8 @@ def test_main_test7(m_isfile, m_longbowmain):
assert params["resource"] == "big-machine"
assert params["replicates"] == ""
assert params["verbose"] is False
assert err.type == SystemExit
assert err.value.code == 1


@mock.patch('longbow.entrypoints.recovery')
Expand All @@ -344,11 +351,13 @@ def test_main_test8(m_isfile, m_longbowmain, m_recovery):
"--debug"]

with mock.patch('sys.argv', args):

launcher()
with pytest.raises(SystemExit) as err:
launcher()

assert m_longbowmain.call_count == 0
assert m_recovery.call_count == 0
assert err.type == SystemExit
assert err.value.code == 1


@mock.patch('longbow.staging.cleanup')
Expand Down