@@ -11,15 +11,15 @@ def test_database_exists_from_previous_run(connection):
1111
1212 # When using a real SQLite backend (via TEST_NAME), check if the file
1313 # exists, because it gets created automatically.
14- if connection .settings_dict [' ENGINE' ] == ' django.db.backends.sqlite3' :
14+ if connection .settings_dict [" ENGINE" ] == " django.db.backends.sqlite3" :
1515 if not os .path .exists (test_db_name ):
1616 return False
1717
18- orig_db_name = connection .settings_dict [' NAME' ]
19- connection .settings_dict [' NAME' ] = test_db_name
18+ orig_db_name = connection .settings_dict [" NAME" ]
19+ connection .settings_dict [" NAME" ] = test_db_name
2020
2121 # With SQLite memory databases the db never exists.
22- if connection .settings_dict [' NAME' ] == ' :memory:' :
22+ if connection .settings_dict [" NAME" ] == " :memory:" :
2323 return False
2424
2525 try :
@@ -29,7 +29,7 @@ def test_database_exists_from_previous_run(connection):
2929 return False
3030 finally :
3131 connection .close ()
32- connection .settings_dict [' NAME' ] = orig_db_name
32+ connection .settings_dict [" NAME" ] = orig_db_name
3333
3434
3535def _monkeypatch (obj , method_name , new_method ):
@@ -43,8 +43,9 @@ def _monkeypatch(obj, method_name, new_method):
4343 setattr (obj , method_name , wrapped_method )
4444
4545
46- def create_test_db_with_reuse (self , verbosity = 1 , autoclobber = False ,
47- keepdb = False , serialize = False ):
46+ def create_test_db_with_reuse (
47+ self , verbosity = 1 , autoclobber = False , keepdb = False , serialize = False
48+ ):
4849 """
4950 This method is a monkey patched version of create_test_db that
5051 will not actually create a new database, but just reuse the
@@ -53,14 +54,16 @@ def create_test_db_with_reuse(self, verbosity=1, autoclobber=False,
5354 This is only used with Django < 1.8.
5455 """
5556 test_database_name = self ._get_test_db_name ()
56- self .connection .settings_dict [' NAME' ] = test_database_name
57+ self .connection .settings_dict [" NAME" ] = test_database_name
5758
5859 if verbosity >= 1 :
59- test_db_repr = ''
60+ test_db_repr = ""
6061 if verbosity >= 2 :
6162 test_db_repr = " ('%s')" % test_database_name
62- print ("Re-using existing test database for alias '%s'%s..." % (
63- self .connection .alias , test_db_repr ))
63+ print (
64+ "Re-using existing test database for alias '%s'%s..."
65+ % (self .connection .alias , test_db_repr )
66+ )
6467
6568 return test_database_name
6669
@@ -70,5 +73,6 @@ def monkey_patch_creation_for_db_reuse():
7073
7174 for connection in connections .all ():
7275 if test_database_exists_from_previous_run (connection ):
73- _monkeypatch (connection .creation , 'create_test_db' ,
74- create_test_db_with_reuse )
76+ _monkeypatch (
77+ connection .creation , "create_test_db" , create_test_db_with_reuse
78+ )
0 commit comments