@mock.patch("bentomakerlib.bentomaker.pprint", lambda color, s, fout=None: None)
    def test_simple(self):
        errors = (
            (UsageException, 2),
            (ParseError, 2),
            (ConvertionError, 2),
            (CommandExecutionFailure, 2),
            (bento.errors.ConfigurationError, 2),
            (bento.errors.BuildError, 2),
            (bento.errors.InvalidPackage, 2),
            (Exception, 1),
        )
        for klass, error_code in errors:
            old_main = bentomakerlib.bentomaker.main
            bentomakerlib.bentomaker.main = lambda argv: raise_function(klass)
            try:
                try:
                    noexc_main()
                except __HOLE__:
                    e = extract_exception()
                    self.assertEqual(e.code, error_code,
                                     "Expected error code %d for exception type(%r)" % \
                                             (error_code, klass))
            finally:
                bentomakerlib.bentomaker.main = old_main
dataset/ETHPy150Open cournape/Bento/bentomakerlib/tests/test_bentomaker.py/TestBentomakerError.test_simple