Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Commit

Permalink
Make manifests_util use new exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Cmiel <acmiel@redhat.com>
  • Loading branch information
chmeliik committed Apr 2, 2019
1 parent aac9425 commit f289691
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions omps/manifests_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import yaml

from operatorcourier.api import build_and_verify
from omps.errors import QuayCourierError
from omps.errors import raise_for_courier_exception

logger = logging.getLogger(__name__)

Expand All @@ -31,7 +31,7 @@ def from_dir(cls, source_dir_path):
bundle = build_and_verify(source_dir_path)
except Exception as e:
msg = "Operator courier failed: {}".format(e)
raise QuayCourierError(msg)
raise_for_courier_exception(e, new_msg=msg)
return cls(bundle)

def __init__(self, bundle):
Expand Down
6 changes: 4 additions & 2 deletions tests/test_manifest_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest

from omps.errors import QuayCourierError
from omps.errors import PackageValidationError
from omps.manifests_util import ManifestBundle


Expand All @@ -18,10 +18,12 @@ def test_invalid_bundle(self):
"""Test if proper exception is raised when source data are invalid.
Uses empty dir to force operator-courier to raise an exception
"""
with pytest.raises(QuayCourierError), \
with pytest.raises(PackageValidationError) as exc_info, \
tempfile.TemporaryDirectory() as tmpdir:
ManifestBundle.from_dir(tmpdir)

assert str(exc_info.value).startswith('Operator courier failed: ')

def test_package_name(self, valid_manifest_dir):
"""Test of property which provides package name"""
mb = ManifestBundle.from_dir(valid_manifest_dir.path)
Expand Down

0 comments on commit f289691

Please sign in to comment.