mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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'].
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							62254c5202
						
					
				
				
					commit
					664c98f1f8
				
			| @@ -98,4 +98,6 @@ class DatabaseCreation(BaseDatabaseCreation): | ||||
|         sig = [self.connection.settings_dict['NAME']] | ||||
|         if self.is_in_memory_db(test_database_name): | ||||
|             sig.append(self.connection.alias) | ||||
|         else: | ||||
|             sig.append(test_database_name) | ||||
|         return tuple(sig) | ||||
|   | ||||
							
								
								
									
										18
									
								
								tests/backends/sqlite/test_creation.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								tests/backends/sqlite/test_creation.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| 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 | ||||
		Reference in New Issue
	
	Block a user