summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-05-27 23:03:21 +0200
committerClaude Paroz <claude@2xlibre.net>2012-05-27 23:03:21 +0200
commitcc4b4d9fd34d9b601de0bafaa3c1f249729fa49a (patch)
tree1c297e4a24ca9d6ebd0d20ff5d2cb1176b5de641 /tests
parentf2b6763ad7cb281ca8699a9c3d532a82f965be4f (diff)
Used CommandError in createcachetable command.
Raising CommandError whenever a management command meets an error condition is the standard way to handle errors in commands.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/cache/tests.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py
index cbba7c19a3..88fe5471cf 100644
--- a/tests/regressiontests/cache/tests.py
+++ b/tests/regressiontests/cache/tests.py
@@ -7,7 +7,6 @@ from __future__ import absolute_import
import hashlib
import os
import re
-import StringIO
import tempfile
import time
import warnings
@@ -820,9 +819,14 @@ class DBCacheTests(BaseCacheTests, TransactionTestCase):
self.perform_cull_test(50, 18)
def test_second_call_doesnt_crash(self):
- err = StringIO.StringIO()
- management.call_command('createcachetable', self._table_name, verbosity=0, interactive=False, stderr=err)
- self.assertTrue(b"Cache table 'test cache table' could not be created" in err.getvalue())
+ with self.assertRaisesRegexp(management.CommandError,
+ "Cache table 'test cache table' could not be created"):
+ management.call_command(
+ 'createcachetable',
+ self._table_name,
+ verbosity=0,
+ interactive=False
+ )
@override_settings(USE_TZ=True)