You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/08/20 15:28:34 UTC
[08/25] git commit: [#6553] fix tests corresponding to taskd error
handling
[#6553] fix tests corresponding to taskd error handling
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6657808d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6657808d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6657808d
Branch: refs/heads/db/6482
Commit: 6657808db549aa90dfff9e0ca6c45f8b2bfaddad
Parents: c700603
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Aug 14 13:32:53 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 14 13:32:53 2013 +0000
----------------------------------------------------------------------
Allura/allura/tests/test_commands.py | 3 +--
Allura/allura/tests/test_tasks.py | 12 +++++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6657808d/Allura/allura/tests/test_commands.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_commands.py b/Allura/allura/tests/test_commands.py
index 0cecfbf..09dc3b6 100644
--- a/Allura/allura/tests/test_commands.py
+++ b/Allura/allura/tests/test_commands.py
@@ -344,8 +344,7 @@ class TestBackgroundCommand(object):
def test_invalid_args(self):
M.MonQTask.query.remove()
show_models.ReindexCommand.post('--invalid-option')
- with td.raises(Exception):
- M.MonQTask.run_ready()
+ M.MonQTask.run_ready()
task = M.MonQTask.query.get(task_name=self.task_name)
assert_equal(task.state, 'error')
assert_in('Error parsing args', task.result)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6657808d/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index c85ce50..c72d253 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -21,6 +21,7 @@ import operator
import sys
import unittest
from base64 import b64encode
+import logging
import mock
from pylons import tmpl_context as c, app_globals as g
@@ -28,6 +29,7 @@ from datadiff.tools import assert_equal
from nose.tools import assert_in
from ming.orm import FieldProperty, Mapper
from ming.orm import ThreadLocalORMSession
+from testfixtures import LogCapture
from alluratest.controller import setup_basic_test, setup_global_objects
@@ -74,7 +76,15 @@ class TestEventTasks(unittest.TestCase):
setup_basic_test()
setup_global_objects()
t = raise_exc.post()
- self.assertRaises(CompoundError, t)
+ with LogCapture(level=logging.ERROR) as l:
+ t()
+ # l.check() would be nice, but string is too detailed to check
+ assert_equal(l.records[0].name, 'allura.model.monq_model')
+ msg = l.records[0].getMessage()
+ assert_in("AssertionError('assert 0',)", msg)
+ assert_in("AssertionError('assert 5',)", msg)
+ assert_in(' on job <MonQTask ', msg)
+ assert_in(' (error) P:10 allura.tests.test_tasks.raise_exc ', msg)
for x in range(10):
assert ('assert %d' % x) in t.result