Files
octopus/myproject/test_output.txt
Andrey Smakotin eef2cb820f refactor: remove unused cleanup_draft_orders management command
The cleanup_draft_orders command was no longer needed in the project.
Also updated test output file with latest test results.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 16:38:00 +03:00

1067 lines
53 KiB
Plaintext

Creating test database for alias 'default' ('test_inventory_db')...
Found 5 test(s).
=== Starting migration
Operations to perform:
Synchronize unmigrated apps: django_filters, django_tenants, messages, nested_admin, simple_history, staticfiles
Apply all migrations: accounts, admin, auth, contenttypes, customers, django_celery_results, inventory, orders, products, sessions, tenants
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
Applying contenttypes.0001_initial...
OK
Applying contenttypes.0002_remove_content_type_name...
OK
Applying auth.0001_initial...
OK
Applying auth.0002_alter_permission_name_max_length...
OK
Applying auth.0003_alter_user_email_max_length...
OK
Applying auth.0004_alter_user_username_opts...
OK
Applying auth.0005_alter_user_last_login_null...
OK
Applying auth.0006_require_contenttypes_0002...
OK
Applying auth.0007_alter_validators_add_error_messages...
OK
Applying auth.0008_alter_user_username_max_length...
OK
Applying auth.0009_alter_user_last_name_max_length...
OK
Applying auth.0010_alter_group_name_max_length...
OK
Applying auth.0011_update_proxy_permissions...
OK
Applying auth.0012_alter_user_first_name_max_length...
OK
Applying accounts.0001_initial...
OK
Applying admin.0001_initial...
OK
Applying admin.0002_logentry_remove_auto_add...
OK
Applying admin.0003_logentry_add_action_flag_choices...
OK
Applying inventory.0001_initial...
OK
Applying customers.0001_initial...
OK
Applying orders.0001_initial...
OK
Applying products.0001_initial...
OK
Applying inventory.0002_initial...
OK
Applying orders.0002_initial...
OK
Applying inventory.0003_showcase_reservation_showcase_and_more...
OK
Applying orders.0003_historicalorderitem_is_from_showcase_and_more...
OK
Applying orders.0004_refactor_models_and_add_payment_method...
OK
Applying customers.0002_customer_is_system_customer...
OK
Applying customers.0003_remove_customer_customers_c_loyalty_5162a0_idx_and_more...
OK
Applying customers.0004_customer_wallet_balance_wallettransaction...
OK
Applying django_celery_results.0001_initial...
OK
Applying django_celery_results.0002_add_task_name_args_kwargs...
OK
Applying django_celery_results.0003_auto_20181106_1101...
OK
Applying django_celery_results.0004_auto_20190516_0412...
OK
Applying django_celery_results.0005_taskresult_worker...
OK
Applying django_celery_results.0006_taskresult_date_created...
OK
Applying django_celery_results.0007_remove_taskresult_hidden...
OK
Applying django_celery_results.0008_chordcounter...
OK
Applying django_celery_results.0009_groupresult...
OK
Applying django_celery_results.0010_remove_duplicate_indices...
OK
Applying django_celery_results.0011_taskresult_periodic_task_name...
OK
Applying products.0002_configurablekitproduct_configurablekitoption...
OK
Applying products.0003_alter_configurablekitproduct_options_and_more...
OK
Applying products.0004_configurablekitproductattribute...
OK
Applying products.0005_alter_configurablekitoption_attributes...
OK
Applying products.0006_add_configurablekitoptionattribute...
OK
Applying products.0007_add_kit_to_attribute...
OK
Applying inventory.0004_showcase_is_default_and_more...
OK
Applying products.0008_productkit_showcase_and_more...
OK
Applying inventory.0005_reservation_product_kit_and_more...
OK
Applying inventory.0006_reservation_cart_lock_expires_at_and_more...
OK
Applying orders.0005_remove_historicalorder_discount_amount_and_more...
OK
Applying orders.0006_transaction_delete_payment_and_more...
OK
Applying products.0009_alter_productcategoryphoto_image_and_more...
OK
Applying products.0010_alter_product_cost_price...
OK
Applying sessions.0001_initial...
OK
Applying tenants.0001_initial...
OK
System check identified no issues (0 silenced).
=== Starting migration
Operations to perform:
Apply all migrations: accounts, admin, auth, contenttypes, customers, django_celery_results, inventory, orders, products, sessions, tenants
Running migrations:
Applying contenttypes.0001_initial...
OK
Applying contenttypes.0002_remove_content_type_name...
OK
Applying auth.0001_initial...
OK
Applying auth.0002_alter_permission_name_max_length...
OK
Applying auth.0003_alter_user_email_max_length...
OK
Applying auth.0004_alter_user_username_opts...
OK
Applying auth.0005_alter_user_last_login_null...
OK
Applying auth.0006_require_contenttypes_0002...
OK
Applying auth.0007_alter_validators_add_error_messages...
OK
Applying auth.0008_alter_user_username_max_length...
OK
Applying auth.0009_alter_user_last_name_max_length...
OK
Applying auth.0010_alter_group_name_max_length...
OK
Applying auth.0011_update_proxy_permissions...
OK
Applying auth.0012_alter_user_first_name_max_length...
OK
Applying accounts.0001_initial...
OK
Applying admin.0001_initial...
OK
Applying admin.0002_logentry_remove_auto_add...
OK
Applying admin.0003_logentry_add_action_flag_choices...
OK
Applying inventory.0001_initial...
OK
Applying customers.0001_initial...
OK
Applying orders.0001_initial...
OK
Applying products.0001_initial...
OK
Applying inventory.0002_initial...
OK
Applying orders.0002_initial...
OK
Applying inventory.0003_showcase_reservation_showcase_and_more...
OK
Applying orders.0003_historicalorderitem_is_from_showcase_and_more...
OK
Applying orders.0004_refactor_models_and_add_payment_method...
OK
Applying customers.0002_customer_is_system_customer...
OK
Applying customers.0003_remove_customer_customers_c_loyalty_5162a0_idx_and_more...
OK
Applying customers.0004_customer_wallet_balance_wallettransaction...
OK
Applying django_celery_results.0001_initial...
OK
Applying django_celery_results.0002_add_task_name_args_kwargs...
OK
Applying django_celery_results.0003_auto_20181106_1101...
OK
Applying django_celery_results.0004_auto_20190516_0412...
OK
Applying django_celery_results.0005_taskresult_worker...
OK
Applying django_celery_results.0006_taskresult_date_created...
OK
Applying django_celery_results.0007_remove_taskresult_hidden...
OK
Applying django_celery_results.0008_chordcounter...
OK
Applying django_celery_results.0009_groupresult...
OK
Applying django_celery_results.0010_remove_duplicate_indices...
OK
Applying django_celery_results.0011_taskresult_periodic_task_name...
OK
Applying products.0002_configurablekitproduct_configurablekitoption...
OK
Applying products.0003_alter_configurablekitproduct_options_and_more...
OK
Applying products.0004_configurablekitproductattribute...
OK
Applying products.0005_alter_configurablekitoption_attributes...
OK
Applying products.0006_add_configurablekitoptionattribute...
OK
Applying products.0007_add_kit_to_attribute...
OK
Applying inventory.0004_showcase_is_default_and_more...
OK
Applying products.0008_productkit_showcase_and_more...
OK
Applying inventory.0005_reservation_product_kit_and_more...
OK
Applying inventory.0006_reservation_cart_lock_expires_at_and_more...
OK
Applying orders.0005_remove_historicalorder_discount_amount_and_more...
OK
Applying orders.0006_transaction_delete_payment_and_more...
OK
Applying products.0009_alter_productcategoryphoto_image_and_more...
OK
Applying products.0010_alter_product_cost_price...
OK
Applying sessions.0001_initial...
OK
Applying tenants.0001_initial...
OK
test_01_draft_to_completed_to_cancelled_to_completed (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_01_draft_to_completed_to_cancelled_to_completed)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #1: ╠эюцхёЄтхээ√х яхЁхїюф√ ьхцфє ёЄрЄєёрьш ... ERROR
test_01_draft_to_completed_to_cancelled_to_completed (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_01_draft_to_completed_to_cancelled_to_completed)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #1: ╠эюцхёЄтхээ√х яхЁхїюф√ ьхцфє ёЄрЄєёрьш ... ERROR
test_02_draft_to_cancelled_releases_reservations (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_02_draft_to_cancelled_releases_reservations)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #2: ╬Єьхэр шч ўхЁэютшър юётюсюцфрхЄ ЁхчхЁт√ ... ERROR
test_02_draft_to_cancelled_releases_reservations (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_02_draft_to_cancelled_releases_reservations)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #2: ╬Єьхэр шч ўхЁэютшър юётюсюцфрхЄ ЁхчхЁт√ ... ERROR
test_03_cancelled_to_pending_reserves_stock (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_03_cancelled_to_pending_reserves_stock)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #3: ┬ючтЁрЄ шч юЄьхэ√ ЁхчхЁтшЁєхЄ ЄютрЁ ... ERROR
test_03_cancelled_to_pending_reserves_stock (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_03_cancelled_to_pending_reserves_stock)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #3: ┬ючтЁрЄ шч юЄьхэ√ ЁхчхЁтшЁєхЄ ЄютрЁ ... ERROR
test_04_create_order_with_intermediate_status (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_04_create_order_with_intermediate_status)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #4: ╤ючфрэшх чрърчр ё яЁюьхцєЄюўэ√ь ёЄрЄєёюь ... ERROR
test_04_create_order_with_intermediate_status (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_04_create_order_with_intermediate_status)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #4: ╤ючфрэшх чрърчр ё яЁюьхцєЄюўэ√ь ёЄрЄєёюь ... ERROR
test_05_completed_to_draft_rollback_sale (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_05_completed_to_draft_rollback_sale)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #5: ╬ЄърЄ юЄ completed ъ draft ... ERROR
test_05_completed_to_draft_rollback_sale (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_05_completed_to_draft_rollback_sale)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #5: ╬ЄърЄ юЄ completed ъ draft ... ERROR
======================================================================
ERROR: test_01_draft_to_completed_to_cancelled_to_completed (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_01_draft_to_completed_to_cancelled_to_completed)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #1: ╠эюцхёЄтхээ√х яхЁхїюф√ ьхцфє ёЄрЄєёрьш
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 83, in setUp
self._create_test_data()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 184, in _create_test_data
self.product = Product.objects.create(
~~~~~~~~~~~~~~~~~~~~~~^
name='╥хёЄют√щ ЄютрЁ',
^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
base_price=Decimal('10.00')
^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 677, in create
obj = self.model(**kwargs)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 567, in __init__
raise TypeError(
...<2 lines>...
)
TypeError: Product() got unexpected keyword arguments: 'category', 'base_price'
======================================================================
ERROR: test_01_draft_to_completed_to_cancelled_to_completed (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_01_draft_to_completed_to_cancelled_to_completed)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #1: ╠эюцхёЄтхээ√х яхЁхїюф√ ьхцфє ёЄрЄєёрьш
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 73, in handle
connection.ops.execute_sql_flush(sql_list)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\base\operations.py", line 461, in execute_sql_flush
cursor.execute(sql)
~~~~~~~~~~~~~~^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 296, in _setup_and_call
self._post_teardown()
~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1102, in _post_teardown
self._fixture_teardown()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1136, in _fixture_teardown
call_command(
~~~~~~~~~~~~^
"flush",
^^^^^^^^
...<5 lines>...
inhibit_post_migrate=inhibit_post_migrate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\__init__.py", line 194, in call_command
return command.execute(*args, **defaults)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 75, in handle
raise CommandError(
...<7 lines>...
) from exc
django.core.management.base.CommandError: Database test_inventory_db couldn't be flushed. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the expected database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
======================================================================
ERROR: test_02_draft_to_cancelled_releases_reservations (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_02_draft_to_cancelled_releases_reservations)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #2: ╬Єьхэр шч ўхЁэютшър юётюсюцфрхЄ ЁхчхЁт√
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 80, in setUp
self._create_system_entities()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 156, in _create_system_entities
self.payment_method = PaymentMethod.objects.create(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
code='cash',
^^^^^^^^^^^^
...<2 lines>...
is_active=True
^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 679, in create
obj.save(force_insert=True, using=self.db)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 822, in save
self.save_base(
~~~~~~~~~~~~~~^
using=using,
^^^^^^^^^^^^
...<2 lines>...
update_fields=update_fields,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 909, in save_base
updated = self._save_table(
raw,
...<4 lines>...
update_fields,
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1071, in _save_table
results = self._do_insert(
cls._base_manager, using, fields, returning_fields, raw
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1112, in _do_insert
return manager._insert(
~~~~~~~~~~~~~~~^
[self],
^^^^^^^
...<3 lines>...
raw=raw,
^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 1847, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\sql\compiler.py", line 1823, in execute_sql
cursor.execute(sql, params)
~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
django.db.utils.IntegrityError: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
======================================================================
ERROR: test_02_draft_to_cancelled_releases_reservations (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_02_draft_to_cancelled_releases_reservations)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #2: ╬Єьхэр шч ўхЁэютшър юётюсюцфрхЄ ЁхчхЁт√
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 73, in handle
connection.ops.execute_sql_flush(sql_list)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\base\operations.py", line 461, in execute_sql_flush
cursor.execute(sql)
~~~~~~~~~~~~~~^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 296, in _setup_and_call
self._post_teardown()
~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1102, in _post_teardown
self._fixture_teardown()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1136, in _fixture_teardown
call_command(
~~~~~~~~~~~~^
"flush",
^^^^^^^^
...<5 lines>...
inhibit_post_migrate=inhibit_post_migrate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\__init__.py", line 194, in call_command
return command.execute(*args, **defaults)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 75, in handle
raise CommandError(
...<7 lines>...
) from exc
django.core.management.base.CommandError: Database test_inventory_db couldn't be flushed. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the expected database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
======================================================================
ERROR: test_03_cancelled_to_pending_reserves_stock (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_03_cancelled_to_pending_reserves_stock)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #3: ┬ючтЁрЄ шч юЄьхэ√ ЁхчхЁтшЁєхЄ ЄютрЁ
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 80, in setUp
self._create_system_entities()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 156, in _create_system_entities
self.payment_method = PaymentMethod.objects.create(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
code='cash',
^^^^^^^^^^^^
...<2 lines>...
is_active=True
^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 679, in create
obj.save(force_insert=True, using=self.db)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 822, in save
self.save_base(
~~~~~~~~~~~~~~^
using=using,
^^^^^^^^^^^^
...<2 lines>...
update_fields=update_fields,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 909, in save_base
updated = self._save_table(
raw,
...<4 lines>...
update_fields,
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1071, in _save_table
results = self._do_insert(
cls._base_manager, using, fields, returning_fields, raw
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1112, in _do_insert
return manager._insert(
~~~~~~~~~~~~~~~^
[self],
^^^^^^^
...<3 lines>...
raw=raw,
^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 1847, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\sql\compiler.py", line 1823, in execute_sql
cursor.execute(sql, params)
~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
django.db.utils.IntegrityError: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
======================================================================
ERROR: test_03_cancelled_to_pending_reserves_stock (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_03_cancelled_to_pending_reserves_stock)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #3: ┬ючтЁрЄ шч юЄьхэ√ ЁхчхЁтшЁєхЄ ЄютрЁ
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 73, in handle
connection.ops.execute_sql_flush(sql_list)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\base\operations.py", line 461, in execute_sql_flush
cursor.execute(sql)
~~~~~~~~~~~~~~^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 296, in _setup_and_call
self._post_teardown()
~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1102, in _post_teardown
self._fixture_teardown()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1136, in _fixture_teardown
call_command(
~~~~~~~~~~~~^
"flush",
^^^^^^^^
...<5 lines>...
inhibit_post_migrate=inhibit_post_migrate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\__init__.py", line 194, in call_command
return command.execute(*args, **defaults)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 75, in handle
raise CommandError(
...<7 lines>...
) from exc
django.core.management.base.CommandError: Database test_inventory_db couldn't be flushed. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the expected database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
======================================================================
ERROR: test_04_create_order_with_intermediate_status (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_04_create_order_with_intermediate_status)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #4: ╤ючфрэшх чрърчр ё яЁюьхцєЄюўэ√ь ёЄрЄєёюь
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 80, in setUp
self._create_system_entities()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 156, in _create_system_entities
self.payment_method = PaymentMethod.objects.create(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
code='cash',
^^^^^^^^^^^^
...<2 lines>...
is_active=True
^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 679, in create
obj.save(force_insert=True, using=self.db)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 822, in save
self.save_base(
~~~~~~~~~~~~~~^
using=using,
^^^^^^^^^^^^
...<2 lines>...
update_fields=update_fields,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 909, in save_base
updated = self._save_table(
raw,
...<4 lines>...
update_fields,
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1071, in _save_table
results = self._do_insert(
cls._base_manager, using, fields, returning_fields, raw
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1112, in _do_insert
return manager._insert(
~~~~~~~~~~~~~~~^
[self],
^^^^^^^
...<3 lines>...
raw=raw,
^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 1847, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\sql\compiler.py", line 1823, in execute_sql
cursor.execute(sql, params)
~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
django.db.utils.IntegrityError: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
======================================================================
ERROR: test_04_create_order_with_intermediate_status (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_04_create_order_with_intermediate_status)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #4: ╤ючфрэшх чрърчр ё яЁюьхцєЄюўэ√ь ёЄрЄєёюь
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 73, in handle
connection.ops.execute_sql_flush(sql_list)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\base\operations.py", line 461, in execute_sql_flush
cursor.execute(sql)
~~~~~~~~~~~~~~^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 296, in _setup_and_call
self._post_teardown()
~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1102, in _post_teardown
self._fixture_teardown()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1136, in _fixture_teardown
call_command(
~~~~~~~~~~~~^
"flush",
^^^^^^^^
...<5 lines>...
inhibit_post_migrate=inhibit_post_migrate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\__init__.py", line 194, in call_command
return command.execute(*args, **defaults)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 75, in handle
raise CommandError(
...<7 lines>...
) from exc
django.core.management.base.CommandError: Database test_inventory_db couldn't be flushed. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the expected database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
======================================================================
ERROR: test_05_completed_to_draft_rollback_sale (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_05_completed_to_draft_rollback_sale)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #5: ╬ЄърЄ юЄ completed ъ draft
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 80, in setUp
self._create_system_entities()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\myproject\inventory\tests\test_order_status_transitions.py", line 156, in _create_system_entities
self.payment_method = PaymentMethod.objects.create(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
code='cash',
^^^^^^^^^^^^
...<2 lines>...
is_active=True
^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 679, in create
obj.save(force_insert=True, using=self.db)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 822, in save
self.save_base(
~~~~~~~~~~~~~~^
using=using,
^^^^^^^^^^^^
...<2 lines>...
update_fields=update_fields,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 909, in save_base
updated = self._save_table(
raw,
...<4 lines>...
update_fields,
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1071, in _save_table
results = self._do_insert(
cls._base_manager, using, fields, returning_fields, raw
)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\base.py", line 1112, in _do_insert
return manager._insert(
~~~~~~~~~~~~~~~^
[self],
^^^^^^^
...<3 lines>...
raw=raw,
^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\query.py", line 1847, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\models\sql\compiler.py", line 1823, in execute_sql
cursor.execute(sql, params)
~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
django.db.utils.IntegrityError: duplicate key value violates unique constraint "orders_paymentmethod_code_key"
DETAIL: Key (code)=(cash) already exists.
======================================================================
ERROR: test_05_completed_to_draft_rollback_sale (inventory.tests.test_order_status_transitions.OrderStatusTransitionCriticalTest.test_05_completed_to_draft_rollback_sale)
╩╨╚╥╚╫┼╤╩╚╔ ╥┼╤╥ #5: ╬ЄърЄ юЄ completed ъ draft
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
psycopg2.errors.FeatureNotSupported: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 73, in handle
connection.ops.execute_sql_flush(sql_list)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\base\operations.py", line 461, in execute_sql_flush
cursor.execute(sql)
~~~~~~~~~~~~~~^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 79, in execute
return self._execute_with_wrappers(
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sql, params, many=False, executor=self._execute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 100, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\db\backends\utils.py", line 103, in _execute
return self.cursor.execute(sql)
~~~~~~~~~~~~~~~~~~~^^^^^
django.db.utils.NotSupportedError: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "inventory_reservation" references "accounts_customuser".
HINT: Truncate table "inventory_reservation" at the same time, or use TRUNCATE ... CASCADE.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 296, in _setup_and_call
self._post_teardown()
~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1102, in _post_teardown
self._fixture_teardown()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\test\testcases.py", line 1136, in _fixture_teardown
call_command(
~~~~~~~~~~~~^
"flush",
^^^^^^^^
...<5 lines>...
inhibit_post_migrate=inhibit_post_migrate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\__init__.py", line 194, in call_command
return command.execute(*args, **defaults)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
File "C:\Users\team_\Desktop\test_qwen\venv\Lib\site-packages\django\core\management\commands\flush.py", line 75, in handle
raise CommandError(
...<7 lines>...
) from exc
django.core.management.base.CommandError: Database test_inventory_db couldn't be flushed. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the expected database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
----------------------------------------------------------------------
Ran 5 tests in 7.828s
FAILED (errors=10)
Destroying test database for alias 'default' ('test_inventory_db')...