Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.api.views.test_add_forge_now::Tests / Python tests / test_add_forge_request_update_non_existent
Failed

TEST RESULT

Run At
Mar 17 2022, 10:39 AM
Details
self = <django.db.backends.utils.CursorWrapper object at 0x7f0b66a23b00> sql = 'INSERT INTO "django_content_type" ("app_label", "model") VALUES (%s, %s) RETURNING "django_content_type"."id"' params = ('swh.web.add_forge_now', 'dummy') ignored_wrapper_args = (False, {'connection': <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f0b6eb45400>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f0b66a23b00>}) def _execute(self, sql, params, *ignored_wrapper_args): self.db.validate_no_broken_transaction() with self.db.wrap_database_errors: if params is None: return self.cursor.execute(sql) else: > return self.cursor.execute(sql, params) E psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "django_content_type_pkey" E DETAIL: Key (id)=(1) already exists. .tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:84: UniqueViolation The above exception was the direct cause of the following exception: @pytest.fixture def add_forge_moderator(): moderator = User.objects.create_user(username="add-forge moderator", password="") moderator.user_permissions.add( > create_django_permission(ADD_FORGE_MODERATOR_PERMISSION) ) .tox/py3/lib/python3.7/site-packages/swh/web/tests/conftest.py:1224: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:230: in create_django_permission content_type = ContentType.objects.create(app_label=app_label, model="dummy") .tox/py3/lib/python3.7/site-packages/django/db/models/manager.py:82: in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) .tox/py3/lib/python3.7/site-packages/django/db/models/query.py:422: in create obj.save(force_insert=True, using=self.db) .tox/py3/lib/python3.7/site-packages/django/db/models/base.py:744: in save force_update=force_update, update_fields=update_fields) .tox/py3/lib/python3.7/site-packages/django/db/models/base.py:782: in save_base force_update, using, update_fields, .tox/py3/lib/python3.7/site-packages/django/db/models/base.py:873: in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) .tox/py3/lib/python3.7/site-packages/django/db/models/base.py:911: in _do_insert using=using, raw=raw) .tox/py3/lib/python3.7/site-packages/django/db/models/manager.py:82: in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) .tox/py3/lib/python3.7/site-packages/django/db/models/query.py:1186: in _insert return query.get_compiler(using=using).execute_sql(return_id) .tox/py3/lib/python3.7/site-packages/django/db/models/sql/compiler.py:1377: in execute_sql cursor.execute(sql, params) .tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:67: in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) .tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:76: in _execute_with_wrappers return executor(sql, params, many, context) .tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:84: in _execute return self.cursor.execute(sql, params) .tox/py3/lib/python3.7/site-packages/django/db/utils.py:89: in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <django.db.backends.utils.CursorWrapper object at 0x7f0b66a23b00> sql = 'INSERT INTO "django_content_type" ("app_label", "model") VALUES (%s, %s) RETURNING "django_content_type"."id"' params = ('swh.web.add_forge_now', 'dummy') ignored_wrapper_args = (False, {'connection': <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f0b6eb45400>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f0b66a23b00>}) def _execute(self, sql, params, *ignored_wrapper_args): self.db.validate_no_broken_transaction() with self.db.wrap_database_errors: if params is None: return self.cursor.execute(sql) else: > return self.cursor.execute(sql, params) E django.db.utils.IntegrityError: duplicate key value violates unique constraint "django_content_type_pkey" E DETAIL: Key (id)=(1) already exists. .tox/py3/lib/python3.7/site-packages/django/db/backends/utils.py:84: IntegrityError