Skip to content

Commit f13837e

Browse files
committed
Add support for global test fixtures to avoid loading them for all
tests - Legacy-Id: 6304
1 parent 0c0c0c9 commit f13837e

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

ietf/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@
348348
# DB redesign
349349
USE_DB_REDESIGN_PROXY_CLASSES = True
350350

351-
SOUTH_TESTS_MIGRATE = False
351+
SOUTH_TESTS_MIGRATE = False
352+
TEST_GLOBAL_FIXTURES = ["names"] # fixtures loaded for all tests by test runner
352353

353354
# Generation of bibxml files for xml2rfc
354355
BIBXML_BASE_PATH = '/a/www/ietf-ftp/xml2rfc'

ietf/utils/test_runner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from django.conf import settings
3838
from django.template import TemplateDoesNotExist
3939
from django.test.simple import run_tests as django_run_tests
40+
from django.core.management import call_command
4041

4142
import debug
4243

@@ -55,6 +56,9 @@ def safe_create_1(self, verbosity, *args, **kwargs):
5556
x = old_create(self, 0, *args, **kwargs)
5657
print " Saving test database name "+settings.DATABASES["default"]["NAME"]+"..."
5758
test_database_name = settings.DATABASES["default"]["NAME"]
59+
if settings.TEST_GLOBAL_FIXTURES:
60+
print " Loading globale test fixtures: %s" % ", ".join(settings.TEST_GLOBAL_FIXTURES)
61+
call_command('loaddata', *settings.TEST_GLOBAL_FIXTURES, verbosity=0, commit=False, database="default")
5862
return x
5963

6064
def safe_destroy_0_1(*args, **kwargs):

0 commit comments

Comments
 (0)