1
0
mirror of https://github.com/django/django.git synced 2025-01-10 10:26:34 +00:00
django/tests/backends/sqlite/test_creation.py
Farhaan Bukhsh 664c98f1f8 Fixed #30413 -- Fixed test database signature on SQLite when test database name is provided.
Previously, the same signature was created for multiple in-memory
databases on SQLite when they had tests databases names
DATABASES['TEST']['NAME'].
2019-11-21 19:50:24 +01:00

19 lines
659 B
Python

import copy
import unittest
from django.db import connection
from django.test import SimpleTestCase
@unittest.skipUnless(connection.vendor == 'sqlite', 'SQLite tests')
class TestDbSignatureTests(SimpleTestCase):
def test_custom_test_name(self):
saved_settings = copy.deepcopy(connection.settings_dict)
try:
connection.settings_dict['NAME'] = None
connection.settings_dict['TEST']['NAME'] = 'custom.sqlite.db'
signature = connection.creation.test_db_signature()
self.assertEqual(signature, (None, 'custom.sqlite.db'))
finally:
connection.settings_dict = saved_settings