refactor: port all sys.exit over to kas exceptions
This patch replaces all direct invocations of sys.exit outside of the main invocation to KasUserError based exceptions. By that, only one method for returning is used and return codes can be handled consistently. In addition, this makes it possible to handle specific errors differently. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
committed by
Jan Kiszka
parent
a5750901c6
commit
222f07de69
@@ -25,6 +25,7 @@ import pytest
|
||||
import shutil
|
||||
from kas import kas
|
||||
from kas.libkas import run_cmd
|
||||
from kas.repos import RepoRefError
|
||||
|
||||
|
||||
def test_refspec_switch(changedir, tmpdir):
|
||||
@@ -95,5 +96,5 @@ def test_url_no_refspec(changedir, tmpdir):
|
||||
tdir = str(tmpdir / 'test_url_no_refspec')
|
||||
shutil.copytree('tests/test_refspec', tdir)
|
||||
os.chdir(tdir)
|
||||
with pytest.raises(SystemExit):
|
||||
with pytest.raises(RepoRefError):
|
||||
kas.kas(['shell', 'test4.yml', '-c', 'true'])
|
||||
|
Reference in New Issue
Block a user