Skip to content

Commit

Permalink
Fixed runtests.py problem from [3177] where it assumed you were runni…
Browse files Browse the repository at this point in the history
…ng the tests from within the tests directory

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3181 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jun 20, 2006
1 parent 5f47161 commit 0e92f70
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def log_error(model_name, title, description):

ALWAYS_INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.redirects',
Expand All @@ -35,8 +35,8 @@ def log_error(model_name, title, description):

def get_test_models():
models = []
for loc in MODEL_TESTS_DIR_NAME, REGRESSION_TESTS_DIR_NAME:
for f in os.listdir(loc):
for loc, dirpath in (MODEL_TESTS_DIR_NAME, MODEL_TEST_DIR), (REGRESSION_TESTS_DIR_NAME, REGRESSION_TEST_DIR):
for f in os.listdir(dirpath):
if f.startswith('__init__') or f.startswith('.') or f.startswith('sql'):
continue
models.append((loc, f))
Expand Down Expand Up @@ -139,7 +139,7 @@ def run_tests(self):
TEST_DATABASE_NAME = ":memory:"
else:
# Create the test database and connect to it. We need to autocommit
# if the database supports it because PostgreSQL doesn't allow
# if the database supports it because PostgreSQL doesn't allow
# CREATE/DROP DATABASE statements within transactions.
cursor = connection.cursor()
self._set_autocommit(connection)
Expand All @@ -161,7 +161,7 @@ def run_tests(self):

# Initialize the test database.
cursor = connection.cursor()

# Install the core always installed apps
for app in ALWAYS_INSTALLED_APPS:
self.output(1, "Installing contrib app %s" % app)
Expand Down Expand Up @@ -265,7 +265,7 @@ def run_tests(self):
print "%s error%s:" % (len(error_list), len(error_list) != 1 and 's' or '')
else:
print "All tests passed."

def _set_autocommit(self, connection):
"""
Make sure a connection is in autocommit mode.
Expand Down

0 comments on commit 0e92f70

Please sign in to comment.