mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #19192 -- Allowed running tests with dummy db backend
Thanks Simon Charette for the initial patch, and Jan Bednařík for his work on the ticket.
This commit is contained in:
parent
850630b4b7
commit
b740da3504
3 changed files with 24 additions and 1 deletions
|
@ -261,6 +261,24 @@ class Sqlite3InMemoryTestDbs(unittest.TestCase):
|
|||
db.connections = old_db_connections
|
||||
|
||||
|
||||
class DummyBackendTest(unittest.TestCase):
|
||||
def test_setup_databases(self):
|
||||
"""
|
||||
Test that setup_databases() doesn't fail with dummy database backend.
|
||||
"""
|
||||
runner = DjangoTestSuiteRunner(verbosity=0)
|
||||
old_db_connections = db.connections
|
||||
try:
|
||||
db.connections = db.ConnectionHandler({})
|
||||
old_config = runner.setup_databases()
|
||||
runner.teardown_databases(old_config)
|
||||
except Exception as e:
|
||||
self.fail("setup_databases/teardown_databases unexpectedly raised "
|
||||
"an error: %s" % e)
|
||||
finally:
|
||||
db.connections = old_db_connections
|
||||
|
||||
|
||||
class AutoIncrementResetTest(TransactionTestCase):
|
||||
"""
|
||||
Here we test creating the same model two times in different test methods,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue