You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/08/21 17:27:32 UTC
[50/50] git commit: [#3154] don't hide task errors when run in tests
[#3154] don't hide task errors when run in tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a598db57
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a598db57
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a598db57
Branch: refs/heads/db/3154b
Commit: a598db57dd2e6045839d176665ed09422f65ae21
Parents: a885568
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Aug 21 15:19:43 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 21 15:26:27 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/monq_model.py | 17 +++++++++++------
Allura/test.ini | 3 +++
2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a598db57/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index 3163ea5..faac14b 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -23,6 +23,8 @@ from datetime import datetime, timedelta
import pymongo
from pylons import tmpl_context as c, app_globals as g
+from tg import config
+from paste.deploy.converters import asbool
import ming
from ming.utils import LazyProperty
@@ -257,13 +259,16 @@ class MonQTask(MappedClass):
self.state = 'complete'
return self.result
except Exception, exc:
- log.exception('Error "%s" on job %s', exc, self)
- self.state = 'error'
- if hasattr(exc, 'format_error'):
- self.result = exc.format_error()
- log.error(self.result)
+ if asbool(config.get('monq.raise_errors')):
+ raise
else:
- self.result = traceback.format_exc()
+ log.exception('Error "%s" on job %s', exc, self)
+ self.state = 'error'
+ if hasattr(exc, 'format_error'):
+ self.result = exc.format_error()
+ log.error(self.result)
+ else:
+ self.result = traceback.format_exc()
finally:
self.time_stop = datetime.utcnow()
session(self).flush(self)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a598db57/Allura/test.ini
----------------------------------------------------------------------
diff --git a/Allura/test.ini b/Allura/test.ini
index 2546149..9892e3c 100644
--- a/Allura/test.ini
+++ b/Allura/test.ini
@@ -68,6 +68,9 @@ load_test_data = true
cache_test_data = false
site_admin_project = test
+# useful primarily for test suites, where we want to see the error right away
+monq.raise_errors = true
+
# Set the locations of some static resources
# script_name is the path that is handled by the application
# url_base is the prefix that references to the static resources should have