mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.11.x] Fixed #28498 -- Fixed test database creation with cx_Oracle 6.
Backport of 6784383e93 from master
			
			
This commit is contained in:
		| @@ -96,6 +96,8 @@ class DatabaseCreation(BaseDatabaseCreation): | |||||||
|                     print("Tests cancelled.") |                     print("Tests cancelled.") | ||||||
|                     sys.exit(1) |                     sys.exit(1) | ||||||
|  |  | ||||||
|  |         # Cursor must be closed before closing connection. | ||||||
|  |         cursor.close() | ||||||
|         self._maindb_connection.close()  # done with main user -- test user and tablespaces created |         self._maindb_connection.close()  # done with main user -- test user and tablespaces created | ||||||
|         self._switch_to_test_user(parameters) |         self._switch_to_test_user(parameters) | ||||||
|         return self.connection.settings_dict['NAME'] |         return self.connection.settings_dict['NAME'] | ||||||
| @@ -180,6 +182,8 @@ class DatabaseCreation(BaseDatabaseCreation): | |||||||
|             if verbosity >= 1: |             if verbosity >= 1: | ||||||
|                 print('Destroying test database tables...') |                 print('Destroying test database tables...') | ||||||
|             self._execute_test_db_destruction(cursor, parameters, verbosity) |             self._execute_test_db_destruction(cursor, parameters, verbosity) | ||||||
|  |         # Cursor must be closed before closing connection. | ||||||
|  |         cursor.close() | ||||||
|         self._maindb_connection.close() |         self._maindb_connection.close() | ||||||
|  |  | ||||||
|     def _execute_test_db_creation(self, cursor, parameters, verbosity, keepdb=False): |     def _execute_test_db_creation(self, cursor, parameters, verbosity, keepdb=False): | ||||||
|   | |||||||
| @@ -11,3 +11,5 @@ Bugfixes | |||||||
|  |  | ||||||
| * Fixed GEOS version parsing if the version has a commit hash at the end (new | * Fixed GEOS version parsing if the version has a commit hash at the end (new | ||||||
|   in GEOS 3.6.2) (:ticket:`28441`). |   in GEOS 3.6.2) (:ticket:`28441`). | ||||||
|  |  | ||||||
|  | * Fixed test database creation with ``cx_Oracle`` 6 (:ticket:`28498`). | ||||||
|   | |||||||
| @@ -51,6 +51,7 @@ class SelectForUpdateTests(TransactionTestCase): | |||||||
|  |  | ||||||
|     def end_blocking_transaction(self): |     def end_blocking_transaction(self): | ||||||
|         # Roll back the blocking transaction. |         # Roll back the blocking transaction. | ||||||
|  |         self.cursor.close() | ||||||
|         self.new_connection.rollback() |         self.new_connection.rollback() | ||||||
|         self.new_connection.set_autocommit(True) |         self.new_connection.set_autocommit(True) | ||||||
|  |  | ||||||
| @@ -274,7 +275,10 @@ class SelectForUpdateTests(TransactionTestCase): | |||||||
|             finally: |             finally: | ||||||
|                 # This method is run in a separate thread. It uses its own |                 # This method is run in a separate thread. It uses its own | ||||||
|                 # database connection. Close it without waiting for the GC. |                 # database connection. Close it without waiting for the GC. | ||||||
|                 connection.close() |                 # Connection cannot be closed on Oracle because cursor is still | ||||||
|  |                 # open. | ||||||
|  |                 if connection.vendor != 'oracle': | ||||||
|  |                     connection.close() | ||||||
|  |  | ||||||
|         status = [] |         status = [] | ||||||
|         thread = threading.Thread(target=raw, kwargs={'status': status}) |         thread = threading.Thread(target=raw, kwargs={'status': status}) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user