Changeset 7809 for django/branches/newforms-admin/django/test/testcases.py
- Timestamp:
- 06/30/08 10:38:16 (6 months ago)
- Files:
-
- django/branches/newforms-admin (modified) (1 prop)
- django/branches/newforms-admin/django/test/testcases.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin
- Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7768 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7808
django/branches/newforms-admin/django/test/testcases.py
r7584 r7809 5 5 from django.http import QueryDict 6 6 from django.db import transaction 7 from django.conf import settings 7 8 from django.core import mail 8 9 from django.core.management import call_command 9 10 from django.test import _doctest as doctest 10 11 from django.test.client import Client 12 from django.core.urlresolvers import clear_url_caches 11 13 12 14 normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s) … … 55 57 * If the Test Case class has a 'fixtures' member, installing the 56 58 named fixtures. 59 * If the Test Case class has a 'urls' member, replace the 60 ROOT_URLCONF with it. 57 61 * Clearing the mail test outbox. 58 62 """ … … 62 66 # that we're using *args and **kwargs together. 63 67 call_command('loaddata', *self.fixtures, **{'verbosity': 0}) 68 if hasattr(self, 'urls'): 69 self._old_root_urlconf = settings.ROOT_URLCONF 70 settings.ROOT_URLCONF = self.urls 71 clear_url_caches() 64 72 mail.outbox = [] 65 73 … … 80 88 return 81 89 super(TestCase, self).__call__(result) 90 try: 91 self._post_teardown() 92 except (KeyboardInterrupt, SystemExit): 93 raise 94 except Exception: 95 import sys 96 result.addError(self, sys.exc_info()) 97 return 98 99 def _post_teardown(self): 100 """ Performs any post-test things. This includes: 101 102 * Putting back the original ROOT_URLCONF if it was changed. 103 """ 104 if hasattr(self, '_old_root_urlconf'): 105 settings.ROOT_URLCONF = self._old_root_urlconf 106 clear_url_caches() 82 107 83 108 def assertRedirects(self, response, expected_url, status_code=302,
