mirror of https://github.com/django/django.git
Ensure that assertNumQueries doesn't swallow exceptions inside the function.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14405 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
429473a522
commit
6824c9b796
|
@ -524,7 +524,10 @@ class TransactionTestCase(ut2.TestCase):
|
||||||
context.__enter__()
|
context.__enter__()
|
||||||
try:
|
try:
|
||||||
func(*args, **kwargs)
|
func(*args, **kwargs)
|
||||||
finally:
|
except:
|
||||||
|
context.__exit__(*sys.exc_info())
|
||||||
|
raise
|
||||||
|
else:
|
||||||
context.__exit__(*sys.exc_info())
|
context.__exit__(*sys.exc_info())
|
||||||
|
|
||||||
def connections_support_transactions():
|
def connections_support_transactions():
|
||||||
|
|
|
@ -8,6 +8,14 @@ if sys.version_info >= (2, 5):
|
||||||
|
|
||||||
|
|
||||||
class SkippingTestCase(TestCase):
|
class SkippingTestCase(TestCase):
|
||||||
|
def test_assert_num_queries(self):
|
||||||
|
def test_func():
|
||||||
|
raise ValueError
|
||||||
|
|
||||||
|
self.assertRaises(ValueError,
|
||||||
|
self.assertNumQueries, 2, test_func
|
||||||
|
)
|
||||||
|
|
||||||
def test_skip_unless_db_feature(self):
|
def test_skip_unless_db_feature(self):
|
||||||
"A test that might be skipped is actually called."
|
"A test that might be skipped is actually called."
|
||||||
# Total hack, but it works, just want an attribute that's always true.
|
# Total hack, but it works, just want an attribute that's always true.
|
||||||
|
|
Loading…
Reference in New Issue