From ba476c6ac77b0cc58ab383c9f543df401f5953a6 Mon Sep 17 00:00:00 2001 From: mattbasta Date: Tue, 11 Jan 2011 14:52:47 -0500 Subject: [PATCH] Prevented failure in undetermined mode on warnings for bug 624928 --- tests/test_submain.py | 2 +- validator/errorbundler.py | 4 ++-- validator/submain.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_submain.py b/tests/test_submain.py index 0e268da..d909e25 100644 --- a/tests/test_submain.py +++ b/tests/test_submain.py @@ -174,6 +174,6 @@ class MockErrorHandler: assert y is None assert z is None - def failed(self): + def failed(self, fail_on_warnings=False): "Simple accessor because the standard error handler has one" return self.has_failed diff --git a/validator/errorbundler.py b/validator/errorbundler.py index 00d1e99..46480d1 100644 --- a/validator/errorbundler.py +++ b/validator/errorbundler.py @@ -137,11 +137,11 @@ class ErrorBundle(object): "Stores the type of addon we're scanning" self.detected_type = type_ - def failed(self): + def failed(self, fail_on_warnings=True): """Returns a boolean value describing whether the validation succeeded or not.""" - return self.errors or self.warnings + return self.errors or (fail_on_warnings and self.warnings) def get_resource(self, name): "Retrieves an object that has been stored by another test." diff --git a/validator/submain.py b/validator/submain.py index 04cb3fb..9881600 100644 --- a/validator/submain.py +++ b/validator/submain.py @@ -202,7 +202,7 @@ def test_inner_package(err, package_contents, package): test_func(err, package_contents, package) # Return any errors at the end of the tier if undetermined. - if err.failed() and not err.determined: + if err.failed(fail_on_warnings=False) and not err.determined: err.unfinished = True return err