Changeset 367
- Timestamp:
- 08/01/05 14:09:07 (3 years ago)
- Files:
-
- django/trunk/django/tests (deleted)
- django/trunk/tests/othertests (added)
- django/trunk/tests/othertests/cache.py (added)
- django/trunk/tests/othertests/__init__.py (added)
- django/trunk/tests/othertests/templates.py (added)
- django/trunk/tests/runtests.py (modified) (4 diffs)
- django/trunk/tests/testapp/templatetags (added)
- django/trunk/tests/testapp/templatetags/__init__.py (added)
- django/trunk/tests/testapp/templatetags/testtags.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/runtests.py
r348 r367 9 9 10 10 APP_NAME = 'testapp' 11 OTHER_TESTS_DIR = "othertests" 11 12 TEST_DATABASE_NAME = 'django_test_db' 12 13 … … 14 15 def log_error(model_name, title, description): 15 16 error_list.append({ 16 'title': "%r mod el: %s" % (model_name, title),17 'title': "%r module: %s" % (model_name, title), 17 18 'description': description, 18 19 }) … … 92 93 93 94 # Run the tests for each test model. 95 self.output(1, "Running app tests") 94 96 for model_name in get_test_models(): 95 97 self.output(1, "%s model: Importing" % model_name) … … 111 113 self.output(1, "%s model: Running tests" % model_name) 112 114 runner.run(dtest, clear_globs=True, out=sys.stdout.write) 113 115 116 # Run the non-model tests in the other tests dir 117 self.output(1, "Running other tests") 118 other_tests_dir = os.path.join(os.path.dirname(__file__), OTHER_TESTS_DIR) 119 test_modules = [f[:-3] for f in os.listdir(other_tests_dir) if f.endswith('.py') and not f.startswith('__init__')] 120 for module in test_modules: 121 self.output(1, "%s module: Importing" % module) 122 try: 123 mod = __import__("othertests." + module, '', '', ['']) 124 except Exception, e: 125 log_error(module, "Error while importing", ''.join(traceback.format_exception(*sys.exc_info())[1:])) 126 continue 127 if mod.__doc__: 128 p = doctest.DocTestParser() 129 dtest = p.get_doctest(mod.__doc__, mod.__dict__, module, None, None) 130 runner = DjangoDoctestRunner(verbosity_level=verbosity_level, verbose=False) 131 self.output(1, "%s module: runing tests" % module) 132 runner.run(dtest, clear_globs=True, out=sys.stdout.write) 133 if hasattr(mod, "run_tests") and callable(mod.run_tests): 134 self.output(1, "%s module: runing tests" % module) 135 try: 136 mod.run_tests(verbosity_level) 137 except Exception, e: 138 log_error(module, "Exception running tests", ''.join(traceback.format_exception(*sys.exc_info())[1:])) 139 continue 140 114 141 # Unless we're using SQLite, remove the test database to clean up after 115 142 # ourselves. Connect to the previous database (not the test database)
