Tests / apps/orgs/tests.py
SlugTest::test_unique_and_not_reserved
First seen 1 month, 1 week ago in 78a4357
CI
github-actions:test
15 runs
Average
18 ms
median 17 ms
max 45 ms
max 45 ms
Phases
Setup 11 ms
Call 6 ms
Teardown 0.78 ms
Categories
Database 16 ms
Other (Unsampled, pytest, Libraries) 2 ms
11 database queries per run
Needs 141 KB of memory (max 192 KB)
Duration per run
Where the time goes
Latest run in ci:github-actions:test, 2 weeks ago ·
open run
setup7 ms57.9%
TestCase.setUpClassdjango/test/testcases.py:1423 cls.cls_atomics = cls._enter_atomics()7 ms57.9%
TestCase._enter_atomicsdjango/test/testcases.py:13967 ms57.9%
Atomic.__enter__django/db/transaction.py:1987 ms57.9%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:4547 ms57.9%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:3037 ms57.9%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:267 ms57.9%
BaseDatabaseWrapper.ensure_connectiondjango/db/backends/base/base.py:2797 ms57.9%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:267 ms57.9%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2567 ms57.9%
DatabaseWrapper.get_new_connectionft/db/postgresql/base.py:39 return super().get_new_connection(conn_params)7 ms57.9%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:267 ms57.9%
DatabaseWrapper.get_new_connectiondjango/db/backends/postgresql/base.py:3337 ms57.9%
Connection.connectpsycopg/connection.py:1097 ms57.9%
wait_connpsycopg/waiting.py:1415 ms41.4%
EpollSelector.select<stdlib>/selectors.py:4525 ms41.4%
wait_connpsycopg/waiting.py:1452 ms16.5%
BaseConnection._connect_genpsycopg/_connection_base.py:4392 ms16.5%
call5 ms39.4%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:19 Organization.objects.create(name="Acme", slug="acme")2 ms19.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms19.7%
QuerySet.createdjango/db/models/query.py:6692 ms19.7%
Model.savedjango/db/models/base.py:8742 ms19.7%
Model.save_basedjango/db/models/base.py:9662 ms19.7%
Model._save_tabledjango/db/models/base.py:11672 ms19.7%
Model._do_insertdjango/db/models/base.py:12182 ms19.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms19.7%
QuerySet._insertdjango/db/models/query.py:19182 ms19.7%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19252 ms19.7%
CursorWrapper.executedjango/db/backends/utils.py:792 ms19.7%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms19.7%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms19.7%
Cursor.executepsycopg/cursor.py:1132 ms19.7%
Connection.waitpsycopg/connection.py:4952 ms19.7%
SlugTest.test_unique_and_not_reservedapps/orgs/tests.py:222 ms19.7%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():2 ms19.7%
QuerySet.existsdjango/db/models/query.py:13372 ms19.7%
Query.has_resultsdjango/db/models/sql/query.py:6812 ms19.7%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15922 ms19.7%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms19.7%
CursorWrapper.executedjango/db/backends/utils.py:792 ms19.7%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms19.7%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms19.7%
Cursor.executepsycopg/cursor.py:1132 ms19.7%
Connection.waitpsycopg/connection.py:4952 ms19.7%
Estimated from 9 samples; phase durations are exact. Frames from pytest and pluggy are
hidden
.
Hot lines in your code
|
ft/db/postgresql/base.py:39
return super().get_new_connection(conn_params)
DatabaseWrapper.get_new_connection
· Database
|
7 ms |
|
apps/orgs/tests.py:19
Organization.objects.create(name="Acme", slug="acme")
SlugTest.test_unique_and_not_reserved
· Database
|
2 ms |
|
apps/orgs/models.py:46
while slug in reserved or taken.filter(slug=slug).exists():
unique_slug
· Database
|
2 ms |
Fixtures
Exact setup time| _unittest_setUpClass_fixture_SlugTest class | 6 ms |
| _django_setup_unittest class | 0.19 ms |
| _django_db_marker function | 0.04 ms |
| _dj_autoclear_mailbox function | 0.04 ms |
| _django_set_urlconf function | 0.03 ms |
| _template_string_if_invalid_marker function | 0.03 ms |
| _live_server_helper function | 0.02 ms |
| _django_clear_site_cache function | 0.02 ms |
| monkeypatch function | 0.01 ms |
Database
11 queries · 3 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
|
7 ms |
|
call test body
apps/orgs/tests.py:19
|
5 ms |
Reliability
15 results · 0 CI failures · 0 local failuresThis test hasn't failed recently.
History
Latest 15 results, oldest first in the strip| When | Environment | Outcome | Duration | |
|---|---|---|---|---|
| 2 weeks ago | CI github-actions:test | passed | 13 ms | Profile |
| 2 weeks, 4 days ago | CI github-actions:test | passed | 21 ms | Profile |
| 2 weeks, 6 days ago | CI github-actions:test | passed | 11 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 17 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 11 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 17 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 13 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 17 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 12 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 21 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 17 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 18 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 45 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 12 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 20 ms | Profile |