flakytest.dev anze3db flakytest
Tests / apps/orgs/tests.py

SlugTest::test_unique_and_not_reserved

First seen 8 hours ago in 78a4357
CI github-actions:test 5 runs
Average
22 ms
median 18 ms
max 45 ms
Phases
Setup 14 ms Call 7 ms Teardown 1 ms
Categories
Database 20 ms Other (Unsampled, pytest) 3 ms

11 database queries per run

Needs 154 KB of memory (max 192 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, an hour ago · open run
Show pytest frames
setup10 ms55.3%
TestCase.setUpClassdjango/test/testcases.py:1423 cls.cls_atomics = cls._enter_atomics()8 ms49.2%
TestCase._enter_atomicsdjango/test/testcases.py:13968 ms49.2%
Atomic.__enter__django/db/transaction.py:1988 ms49.2%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:4548 ms49.2%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:3038 ms49.2%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:268 ms49.2%
BaseDatabaseWrapper.ensure_connectiondjango/db/backends/base/base.py:2798 ms49.2%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:268 ms49.2%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2567 ms43.0%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:267 ms43.0%
DatabaseWrapper.get_new_connectiondjango/db/backends/postgresql/base.py:3337 ms43.0%
Connection.connectpsycopg/connection.py:1096 ms36.9%
wait_connpsycopg/waiting.py:1413 ms18.4%
EpollSelector.select<stdlib>/selectors.py:4523 ms18.4%
wait_connpsycopg/waiting.py:1453 ms18.4%
BaseConnection._connect_genpsycopg/_connection_base.py:4393 ms18.4%
Connection.connectpsycopg/connection.py:1001 ms6.1%
conninfo_attemptspsycopg/_conninfo_attempts.py:451 ms6.1%
_resolve_hostnamespsycopg/_conninfo_attempts.py:1021 ms6.1%
getaddrinfo<stdlib>/socket.py:9981 ms6.1%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2581 ms6.1%
DatabaseWrapper.init_connection_statedjango/db/backends/postgresql/base.py:4021 ms6.1%
DatabaseWrapper._configure_connectiondjango/db/backends/postgresql/base.py:3741 ms6.1%
DatabaseWrapper._configure_timezonedjango/db/backends/postgresql/base.py:3571 ms6.1%
Cursor.executepsycopg/cursor.py:1131 ms6.1%
Connection.waitpsycopg/connection.py:4951 ms6.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2061 ms6.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2861 ms6.1%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:781 ms6.1%
TestCase.setUpClassdjango/test/testcases.py:14171 ms6.1%
TransactionTestCase.setUpClassdjango/test/testcases.py:11301 ms6.1%
SimpleTestCase.setUpClassdjango/test/testcases.py:2251 ms6.1%
SimpleTestCase._add_databases_failuresdjango/test/testcases.py:2641 ms6.1%
call7 ms40.8%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:19 Organization.objects.create(name="Acme", slug="acme")2 ms10.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms10.2%
QuerySet.createdjango/db/models/query.py:6692 ms10.2%
Model.savedjango/db/models/base.py:8742 ms10.2%
Model.save_basedjango/db/models/base.py:9662 ms10.2%
Model._save_tabledjango/db/models/base.py:11672 ms10.2%
Model._do_insertdjango/db/models/base.py:12182 ms10.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms10.2%
QuerySet._insertdjango/db/models/query.py:19182 ms10.2%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19242 ms10.2%
SQLInsertCompiler.as_sqldjango/db/models/sql/compiler.py:18132 ms10.2%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:202 ms10.2%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():2 ms10.2%
QuerySet.existsdjango/db/models/query.py:13372 ms10.2%
Query.has_resultsdjango/db/models/sql/query.py:6812 ms10.2%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15922 ms10.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms10.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms10.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms10.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms10.2%
Cursor.executepsycopg/cursor.py:1132 ms10.2%
Connection.waitpsycopg/connection.py:4952 ms10.2%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:222 ms10.2%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():2 ms10.2%
QuerySet.existsdjango/db/models/query.py:13372 ms10.2%
Query.has_resultsdjango/db/models/sql/query.py:6812 ms10.2%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15922 ms10.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms10.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms10.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms10.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms10.2%
Cursor.executepsycopg/cursor.py:1132 ms10.2%
Connection.waitpsycopg/connection.py:4952 ms10.2%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()2 ms10.2%
TestCase._fixture_teardowndjango/test/testcases.py:14972 ms10.2%
TestCase._rollback_atomicsdjango/test/testcases.py:14052 ms10.2%
Atomic.__exit__django/db/transaction.py:2862 ms10.2%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms10.2%
BaseDatabaseWrapper.savepoint_commitdjango/db/backends/base/base.py:4312 ms10.2%
BaseDatabaseWrapper._savepoint_commitdjango/db/backends/base/base.py:3752 ms10.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms10.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms10.2%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms10.2%
Cursor.executepsycopg/cursor.py:1132 ms10.2%
Connection.waitpsycopg/connection.py:4952 ms10.2%
teardown0.66 ms3.9%
Estimated from 14 samples; phase durations are exact. Frames from pytest and pluggy are hidden .

Hot lines in your code

apps/orgs/models.py:46
while slug in reserved or taken.filter(slug=slug).exists():
unique_slug · Database
4 ms
apps/orgs/tests.py:19
Organization.objects.create(name="Acme", slug="acme")
SlugTest.test_unique_and_not_reserved · Database
2 ms

Fixtures

Exact setup time
_unittest_setUpClass_fixture_SlugTest class 8 ms
_django_setup_unittest class 0.29 ms
_template_string_if_invalid_marker function 0.07 ms
_django_db_marker function 0.04 ms
_dj_autoclear_mailbox function 0.03 ms
_django_set_urlconf function 0.03 ms
_live_server_helper function 0.03 ms
_django_clear_site_cache function 0.03 ms
monkeypatch function 0.02 ms

Database

11 queries · 4 ms

Repeated queries are usually N+1 lookups: fetch them once with select_related / prefetch_related (or selectinload).

5×
SELECT %s AS "a" FROM "orgs_organization" WHERE "orgs_organization"."slug" = %s LIMIT ?

Biggest pieces of work

setup setUpClass
django/test/testcases.py:1423
10 ms
call test body
apps/orgs/tests.py:19
5 ms
call _post_teardown
django/test/testcases.py:1240
2 ms
teardown pytest internals 0.66 ms

Reliability

5 results · 0 CI failures · 0 local failures

This test hasn't failed recently.

History

Latest 5 results, oldest first in the strip
When Environment Outcome Duration Commit
an hour ago CI github-actions:test passed 17 ms 9caa567 main Profile
an hour ago CI github-actions:test passed 18 ms ec75501 main Profile
8 hours ago CI github-actions:test passed 45 ms d2c12e5 main Profile
8 hours ago CI github-actions:test passed 12 ms 0b902f6 main Profile
8 hours ago CI github-actions:test passed 20 ms 78a4357 main Profile