From 0b93c89bc593acf56a3db4b83df3d447747462af Mon Sep 17 00:00:00 2001 From: mprahl Date: Mar 26 2018 13:14:03 +0000 Subject: Fix clarifying error that occurs when mbs-manager is not installed Signed-off-by: mprahl --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index 74cdbfc..6f74ba9 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -2870,8 +2870,8 @@ class Commands(object): try: self._run_command(command) - except OSError as e: - if e.errno == errno.ENOENT: + except rpkgError as e: + if str(e) == '[Errno 2] No such file or directory': raise rpkgError('mbs-manager is missing. Please install ' 'module-build-service.') else: diff --git a/tests/test_cli.py b/tests/test_cli.py index 135b25e..4ab4043 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2234,9 +2234,7 @@ State: failed @patch.object(Commands, '_run_command') def test_module_build_local_mbs_manager_is_missing(self, mock_run): - e = OSError() - e.errno = 2 - mock_run.side_effect = e + mock_run.side_effect = rpkgError('[Errno 2] No such file or directory') cli_cmd = [ 'rpkg', '--path', self.cloned_repo_path, 'module-build-local'