Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fixed #19192 -- DjangoTestSuiteRunner can run with dummy database #475

Closed
wants to merge 1 commit into from

3 participants

Jan Bednařík Claude Paroz Simon Charette
Jan Bednařík

backend.

django/test/simple.py
... ...
@@ -302,19 +302,22 @@ def setup_databases(self, **kwargs):
302 302
         old_names = []
303 303
         mirrors = []
304 304
 
305  
-        for signature, (db_name, aliases) in dependency_ordered(
306  
-            test_databases.items(), dependencies):
  305
+        for signature, (db_name, aliases) in dependency_ordered(test_databases.items(), dependencies):
1
Simon Charette Owner

This change isn't needed and adds a bit of noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
django/test/simple.py
((20 lines not shown))
316 315
                 else:
317  
-                    connection.settings_dict['NAME'] = test_db_name
  316
+                    old_names.append((connection, db_name, True))
  317
+                    if test_db_name is None:
  318
+                        test_db_name = connection.creation.create_test_db(self.verbosity, autoclobber=not self.interactive)
2
Simon Charette Owner

You could put that on two lines, it would increase readability IMHO.

PEP-8 short lines are not mandatory by Django Coding style guide. I personally found more readable long lines than splitted statements. But you have a point. Here on GitHub are better to splitted lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Claude Paroz
Owner

Another approache was chosen. Thanks for your work!

Claude Paroz claudep closed this January 04, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 27, 2012
Jan Bednařík Fixed #19192 -- DjangoTestSuiteRunner can run with dummy database
backend.
f169986
This page is out of date. Refresh to see the latest.
1  AUTHORS
@@ -85,6 +85,7 @@ answer newbie questions, and generally made Django that much better:
85 85
     batiste@dosimple.ch
86 86
     Batman
87 87
     Brian Beck <http://blog.brianbeck.com/>
  88
+    Jan Bednařík <jan.bednarik@gmail.com>
88 89
     Shannon -jj Behrens <http://jjinux.blogspot.com/>
89 90
     Esdras Beleza <linux@esdrasbeleza.com>
90 91
     Chris Bennett <chrisrbennett@yahoo.com>
15  django/test/simple.py
@@ -309,12 +309,17 @@ def setup_databases(self, **kwargs):
309 309
 
310 310
             for alias in aliases:
311 311
                 connection = connections[alias]
312  
-                old_names.append((connection, db_name, True))
313  
-                if test_db_name is None:
314  
-                    test_db_name = connection.creation.create_test_db(
315  
-                            self.verbosity, autoclobber=not self.interactive)
  312
+                # Skip database creation if backend is dummy
  313
+                if connection.settings_dict['ENGINE'] == 'django.db.backends.dummy':
  314
+                    # Set destroy = False for teardown_databases()
  315
+                    old_names.append((connection, db_name, False))
316 316
                 else:
317  
-                    connection.settings_dict['NAME'] = test_db_name
  317
+                    old_names.append((connection, db_name, True))
  318
+                    if test_db_name is None:
  319
+                        test_db_name = connection.creation.create_test_db(
  320
+                            self.verbosity, autoclobber=not self.interactive)
  321
+                    else:
  322
+                        connection.settings_dict['NAME'] = test_db_name
318 323
 
319 324
         for alias, mirror_alias in mirrored_aliases.items():
320 325
             mirrors.append((alias, connections[alias].settings_dict['NAME']))
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.