mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed failing bulk_create test raising IntegrityError when run in reverse.
When running the `bulk_create` tests with Postgres settings and `--reverse`, the following IntegrityError was raised in bulk_create.tests.BulkCreateTransactionTests.test_objs_with_and_without_pk: django.db.utils.IntegrityError: duplicate key value violates unique constraint "bulk_create_country_pkey" DETAIL: Key (id)=(1) already exists. This branch fixes this by ensuring the ID is unique since DB sequences are not resetted between tests.
This commit is contained in:
		| @@ -901,7 +901,7 @@ class BulkCreateTransactionTests(TransactionTestCase): | |||||||
|         with self.assertNumQueries(4): |         with self.assertNumQueries(4): | ||||||
|             Country.objects.bulk_create( |             Country.objects.bulk_create( | ||||||
|                 [ |                 [ | ||||||
|                     Country(id=1, name="France", iso_two_letter="FR"), |                     Country(id=10, name="France", iso_two_letter="FR"), | ||||||
|                     Country(name="Canada", iso_two_letter="CA"), |                     Country(name="Canada", iso_two_letter="CA"), | ||||||
|                 ] |                 ] | ||||||
|             ) |             ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user