3232# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3333# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3434
35- import socket , re , os , time
35+ import socket , re , os , time , importlib
3636
3737from django .conf import settings
3838from django .template import TemplateDoesNotExist
@@ -57,8 +57,18 @@ def safe_create_1(self, verbosity, *args, **kwargs):
5757 print " Using OPTIONS: %s" % settings .DATABASES ["default" ]["OPTIONS" ]
5858 test_database_name = old_create (self , 0 , * args , ** kwargs )
5959 if settings .GLOBAL_TEST_FIXTURES :
60- print " Loading global test fixtures: %s" % ", " .join (settings .GLOBAL_TEST_FIXTURES )
61- call_command ('loaddata' , * settings .GLOBAL_TEST_FIXTURES , verbosity = 0 , commit = False , database = "default" )
60+ print " Loading global test fixtures: %s" % ", " .join (settings .GLOBAL_TEST_FIXTURES )
61+ loadable = [f for f in settings .GLOBAL_TEST_FIXTURES if "." not in f ]
62+ call_command ('loaddata' , * loadable , verbosity = 0 , commit = False , database = "default" )
63+
64+ for f in settings .GLOBAL_TEST_FIXTURES :
65+ if f not in loadable :
66+ # try to execute the fixture
67+ components = f .split ("." )
68+ module = importlib .import_module ("." .join (components [:- 1 ]))
69+ fn = getattr (module , components [- 1 ])
70+ fn ()
71+
6272 return test_database_name
6373
6474def safe_destroy_0_1 (* args , ** kwargs ):
0 commit comments