Page MenuHomeSoftware Heritage
Paste P1313

(An Untitled Masterwork)
ActivePublic

Authored by ardumont on Mar 17 2022, 11:08 AM.
make test-frontend-ui-cmd
rm -f swh-web-test.sqlite3
django-admin migrate --settings=swh.web.settings.tests -v0 2>/dev/null
cat swh/web/tests/create_test_admin.py | django-admin shell --settings=swh.web.settings.tests
cat swh/web/tests/create_test_users.py | django-admin shell --settings=swh.web.settings.tests
Traceback (most recent call last):
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.IntegrityError: UNIQUE constraint failed: django_content_type.id
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/tony/.virtualenvs/swh/bin/django-admin", line 8, in <module>
sys.exit(execute_from_command_line())
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/commands/shell.py", line 92, in handle
exec(sys.stdin.read())
File "<string>", line 40, in <module>
File "/home/tony/work/inria/repo/swh/swh-environment/swh-web/swh/web/tests/utils.py", line 230, in create_django_permission
content_type = ContentType.objects.create(
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/query.py", line 422, in create
obj.save(force_insert=True, using=self.db)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 743, in save
self.save_base(using=using, force_insert=force_insert,
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 780, in save_base
updated = self._save_table(
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 873, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 910, in _do_insert
return manager._insert([self], fields=fields, return_id=update_pk,
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/query.py", line 1186, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1377, in execute_sql
cursor.execute(sql, params)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: UNIQUE constraint failed: django_content_type.id
make: *** [Makefile.local:43: add-users-test] Error 1

Event Timeline

systematically reproduced:

$ cat swh/web/tests/create_test_users.py | django-admin shell --settings=swh.web.settings.tests
Traceback (most recent call last):
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.IntegrityError: UNIQUE constraint failed: django_content_type.id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/tony/.virtualenvs/swh/bin/django-admin", line 8, in <module>
    sys.exit(execute_from_command_line())
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/core/management/commands/shell.py", line 92, in handle
    exec(sys.stdin.read())
  File "<string>", line 40, in <module>
  File "/home/tony/work/inria/repo/swh/swh-environment/swh-web/swh/web/tests/utils.py", line 230, in create_django_permission
    content_type = ContentType.objects.create(
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/query.py", line 422, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 743, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 780, in save_base
    updated = self._save_table(
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 873, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/base.py", line 910, in _do_insert
    return manager._insert([self], fields=fields, return_id=update_pk,
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/query.py", line 1186, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1377, in execute_sql
    cursor.execute(sql, params)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tony/.virtualenvs/swh/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: UNIQUE constraint failed: django_content_type.id