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

SlugTest::test_unique_and_not_reserved

First seen 3 weeks ago in 78a4357
CI github-actions:test 12 runs
Average
18 ms
median 17 ms
max 45 ms
Phases
Setup 11 ms Call 6 ms Teardown 0.87 ms
Categories
Database 16 ms Other (Unsampled, pytest, Libraries) 2 ms

11 database queries per run

Needs 145 KB of memory (max 192 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, 16 hours ago · open run
Show pytest frames
setup10 ms60.4%
TestCase.setUpClassdjango/test/testcases.py:1423 cls.cls_atomics = cls._enter_atomics()9 ms53.7%
TestCase._enter_atomicsdjango/test/testcases.py:13969 ms53.7%
Atomic.__enter__django/db/transaction.py:1989 ms53.7%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:4549 ms53.7%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:3039 ms53.7%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms53.7%
BaseDatabaseWrapper.ensure_connectiondjango/db/backends/base/base.py:2799 ms53.7%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms53.7%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2569 ms53.7%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms53.7%
DatabaseWrapper.get_new_connectiondjango/db/backends/postgresql/base.py:3339 ms53.7%
Connection.connectpsycopg/connection.py:1099 ms53.7%
wait_connpsycopg/waiting.py:1413 ms20.1%
EpollSelector.select<stdlib>/selectors.py:4523 ms20.1%
wait_connpsycopg/waiting.py:1453 ms20.1%
BaseConnection._connect_genpsycopg/_connection_base.py:4393 ms20.1%
wait_connpsycopg/waiting.py:1362 ms13.4%
BaseConnection._connect_genpsycopg/_connection_base.py:4392 ms13.4%
call6 ms36.3%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:19 Organization.objects.create(name="Acme", slug="acme")2 ms12.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms12.1%
QuerySet.createdjango/db/models/query.py:6692 ms12.1%
Model.savedjango/db/models/base.py:8742 ms12.1%
Model.save_basedjango/db/models/base.py:9662 ms12.1%
Model._save_tabledjango/db/models/base.py:11672 ms12.1%
Model._do_insertdjango/db/models/base.py:12182 ms12.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms12.1%
QuerySet._insertdjango/db/models/query.py:19182 ms12.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19252 ms12.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms12.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms12.1%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms12.1%
Cursor.executepsycopg/cursor.py:1132 ms12.1%
Connection.waitpsycopg/connection.py:4952 ms12.1%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:202 ms12.1%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():2 ms12.1%
QuerySet.existsdjango/db/models/query.py:13372 ms12.1%
Query.has_resultsdjango/db/models/sql/query.py:6812 ms12.1%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15922 ms12.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16402 ms12.1%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:212 ms12.1%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():2 ms12.1%
QuerySet.existsdjango/db/models/query.py:13372 ms12.1%
Query.has_resultsdjango/db/models/sql/query.py:6812 ms12.1%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15922 ms12.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms12.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms12.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms12.1%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms12.1%
Cursor.executepsycopg/cursor.py:1132 ms12.1%
Connection.waitpsycopg/connection.py:4952 ms12.1%
Estimated from 12 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 9 ms
_django_setup_unittest class 0.28 ms
_template_string_if_invalid_marker function 0.04 ms
_dj_autoclear_mailbox function 0.04 ms
_django_db_marker function 0.03 ms
_live_server_helper function 0.03 ms
_django_set_urlconf function 0.03 ms
monkeypatch function 0.02 ms
_django_clear_site_cache 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
9 ms
call test body
apps/orgs/tests.py:19
6 ms
setup pytest internals 1 ms

Reliability

12 results · 0 CI failures · 0 local failures

This test hasn't failed recently.

History

Latest 12 results, oldest first in the strip
When Environment Outcome Duration Commit
16 hours ago CI github-actions:test passed 17 ms e141198 main Profile
1 week, 5 days ago CI github-actions:test passed 11 ms 46ec2aa main Profile
2 weeks, 1 day ago CI github-actions:test passed 17 ms afde85b main Profile
2 weeks, 1 day ago CI github-actions:test passed 13 ms fe29f9d main Profile
2 weeks, 1 day ago CI github-actions:test passed 17 ms 044719a main Profile
2 weeks, 2 days ago CI github-actions:test passed 12 ms b3fedae main Profile
2 weeks, 4 days ago CI github-actions:test passed 21 ms 43c4eda main Profile
2 weeks, 6 days ago CI github-actions:test passed 17 ms 9caa567 main Profile
2 weeks, 6 days ago CI github-actions:test passed 18 ms ec75501 main Profile
3 weeks ago CI github-actions:test passed 45 ms d2c12e5 main Profile
3 weeks ago CI github-actions:test passed 12 ms 0b902f6 main Profile
3 weeks ago CI github-actions:test passed 20 ms 78a4357 main Profile