Tests / apps/projects/tests.py
SlugsAndNumbersTest::test_a_taken_number_is_retried
First seen 3 weeks ago in 78a4357
CI
github-actions:test
12 runs
Average
28 ms
median 29 ms
max 36 ms
max 36 ms
Phases
Setup 16 ms
Call 11 ms
Teardown 0.15 ms
Categories
Database 26 ms
Factories 0.12 ms
Other (pytest, Unsampled, Mocking) 2 ms
24 database queries per run
Needs 0 KB of memory (max 4 KB)
Duration per run
Where the time goes
Latest run in ci:github-actions:test, 16 hours ago ·
open run
setup16 ms58.9%
TestCase.setUpClassdjango/test/testcases.py:1423 cls.cls_atomics = cls._enter_atomics()10 ms39.3%
TestCase._enter_atomicsdjango/test/testcases.py:139610 ms39.3%
Atomic.__enter__django/db/transaction.py:19810 ms39.3%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:45410 ms39.3%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:30310 ms39.3%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:2610 ms39.3%
BaseDatabaseWrapper.ensure_connectiondjango/db/backends/base/base.py:27910 ms39.3%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:2610 ms39.3%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2569 ms34.4%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms34.4%
DatabaseWrapper.get_new_connectiondjango/db/backends/postgresql/base.py:3339 ms34.4%
Connection.connectpsycopg/connection.py:1099 ms34.4%
wait_connpsycopg/waiting.py:1415 ms19.6%
EpollSelector.select<stdlib>/selectors.py:4525 ms19.6%
wait_connpsycopg/waiting.py:1454 ms14.7%
BaseConnection._connect_genpsycopg/_connection_base.py:4394 ms14.7%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2581 ms4.9%
DatabaseWrapper.init_connection_statedjango/db/backends/postgresql/base.py:4021 ms4.9%
DatabaseWrapper._configure_connectiondjango/db/backends/postgresql/base.py:3741 ms4.9%
DatabaseWrapper._configure_timezonedjango/db/backends/postgresql/base.py:3571 ms4.9%
Cursor.executepsycopg/cursor.py:1131 ms4.9%
Connection.waitpsycopg/connection.py:4951 ms4.9%
TestCase.setUpClassdjango/test/testcases.py:1439 cls.setUpTestData()4 ms14.7%
SlugsAndNumbersTest.setUpTestDataapps/projects/tests.py:14654 ms14.7%
make_projectapps/projects/testing.py:621 ms4.9%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.9%
QuerySet.existsdjango/db/models/query.py:13371 ms4.9%
Query.has_resultsdjango/db/models/sql/query.py:6811 ms4.9%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15921 ms4.9%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms4.9%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.9%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.9%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.9%
Cursor.executepsycopg/cursor.py:1131 ms4.9%
Connection.waitpsycopg/connection.py:4951 ms4.9%
make_projectapps/projects/testing.py:67 slug=unique_slug(name, organization.project_set.all(), fallback="project", reserved=RESERVED_PROJECT_SLUGS),1 ms4.9%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.9%
QuerySet.existsdjango/db/models/query.py:13371 ms4.9%
Query.has_resultsdjango/db/models/sql/query.py:6811 ms4.9%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15921 ms4.9%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms4.9%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7671 ms4.9%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:861 ms4.9%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:751 ms4.9%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3171 ms4.9%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5781 ms4.9%
Value.as_sqldjango/db/models/expressions.py:11701 ms4.9%
make_projectapps/projects/testing.py:64 project = Project.objects.create(1 ms4.9%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms4.9%
QuerySet.createdjango/db/models/query.py:6691 ms4.9%
Model.savedjango/db/models/base.py:8741 ms4.9%
Model.save_basedjango/db/models/base.py:9661 ms4.9%
Model._save_tabledjango/db/models/base.py:11671 ms4.9%
Model._do_insertdjango/db/models/base.py:12181 ms4.9%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms4.9%
QuerySet._insertdjango/db/models/query.py:19181 ms4.9%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19241 ms4.9%
SQLInsertCompiler.as_sqldjango/db/models/sql/compiler.py:18691 ms4.9%
SQLInsertCompiler.assemble_as_sqldjango/db/backends/postgresql/compiler.py:641 ms4.9%
SQLInsertCompiler.assemble_as_sqldjango/db/models/sql/compiler.py:17851 ms4.9%
TestCase.setUpClassdjango/test/testcases.py:14171 ms4.9%
TransactionTestCase.setUpClassdjango/test/testcases.py:11301 ms4.9%
SimpleTestCase.setUpClassdjango/test/testcases.py:2251 ms4.9%
SimpleTestCase._add_databases_failuresdjango/test/testcases.py:2641 ms4.9%
_patch.__enter__<stdlib>/unittest/mock.py:14911 ms4.9%
call11 ms40.5%
SlugsAndNumbersTest.test_a_taken_number_is_retriedapps/projects/tests.py:15006 ms24.3%
get_or_create_numberedapps/projects/models.py:18 existing = model.objects.filter(project=project, **lookup).first()3 ms12.2%
QuerySet.firstdjango/db/models/query.py:11453 ms12.2%
QuerySet.__iter__django/db/models/query.py:3903 ms12.2%
QuerySet._fetch_alldjango/db/models/query.py:20003 ms12.2%
ModelIterable.__iter__django/db/models/query.py:953 ms12.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms8.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms8.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms8.1%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.1%
Cursor.executepsycopg/cursor.py:1131 ms4.1%
Connection.waitpsycopg/connection.py:4951 ms4.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms4.1%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7671 ms4.1%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:861 ms4.1%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:751 ms4.1%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3171 ms4.1%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5741 ms4.1%
Col.as_sqldjango/db/models/expressions.py:13251 ms4.1%
get_or_create_numberedapps/projects/models.py:24 return model.objects.create(project=project, number=number, **lookup, **(defaults or {})), True2 ms8.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms8.1%
QuerySet.createdjango/db/models/query.py:6692 ms8.1%
Profile.saveapps/projects/models.py:466 super().save(*args, **kwargs)2 ms8.1%
Model.savedjango/db/models/base.py:8742 ms8.1%
Model.save_basedjango/db/models/base.py:9662 ms8.1%
Model._save_tabledjango/db/models/base.py:11672 ms8.1%
Model._do_insertdjango/db/models/base.py:12182 ms8.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms8.1%
QuerySet._insertdjango/db/models/query.py:19182 ms8.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19252 ms8.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms8.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms8.1%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms8.1%
Cursor.executepsycopg/cursor.py:1132 ms8.1%
Connection.waitpsycopg/connection.py:4952 ms8.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2051 ms4.1%
BaseCursor._convert_querypsycopg/_cursor_base.py:4651 ms4.1%
PostgresClientQuery.convertpsycopg/_queries.py:2891 ms4.1%
PostgresClientQuery.dumppsycopg/_queries.py:2991 ms4.1%
PostgresClientQuery.dump.<locals>.<genexpr>psycopg/_queries.py:3001 ms4.1%
get_or_create_numberedapps/projects/models.py:23 with transaction.atomic():1 ms4.1%
Atomic.__exit__django/db/transaction.py:2861 ms4.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:261 ms4.1%
BaseDatabaseWrapper.savepoint_commitdjango/db/backends/base/base.py:4311 ms4.1%
BaseDatabaseWrapper._savepoint_commitdjango/db/backends/base/base.py:3751 ms4.1%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.1%
CursorWrapper._executedjango/db/backends/utils.py:1031 ms4.1%
Cursor.executepsycopg/cursor.py:1131 ms4.1%
Connection.waitpsycopg/connection.py:4951 ms4.1%
SlugsAndNumbersTest.test_a_taken_number_is_retriedapps/projects/tests.py:1498 baker.make(Profile, project=self.project)2 ms8.1%
makemodel_bakery/baker.py:1472 ms8.1%
Baker.makemodel_bakery/baker.py:4062 ms8.1%
Baker._makemodel_bakery/baker.py:4822 ms8.1%
Baker.instancemodel_bakery/baker.py:5352 ms8.1%
Profile.saveapps/projects/models.py:4651 ms4.1%
next_numberapps/projects/models.py:35 return (model.objects.filter(project_id=project_id).aggregate(last=models.Max("number"))["last"] or 0) + 11 ms4.1%
QuerySet.aggregatedjango/db/models/query.py:5941 ms4.1%
Query.get_aggregationdjango/db/models/sql/query.py:6331 ms4.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms4.1%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.1%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.1%
Cursor.executepsycopg/cursor.py:1131 ms4.1%
Connection.waitpsycopg/connection.py:4951 ms4.1%
Profile.saveapps/projects/models.py:466 super().save(*args, **kwargs)1 ms4.1%
Model.savedjango/db/models/base.py:8741 ms4.1%
Model.save_basedjango/db/models/base.py:9661 ms4.1%
Model._save_tabledjango/db/models/base.py:11671 ms4.1%
Model._do_insertdjango/db/models/base.py:12181 ms4.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms4.1%
QuerySet._insertdjango/db/models/query.py:19181 ms4.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19251 ms4.1%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.1%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.1%
Cursor.executepsycopg/cursor.py:1131 ms4.1%
Connection.waitpsycopg/connection.py:4951 ms4.1%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()2 ms8.1%
TestCase._fixture_teardowndjango/test/testcases.py:14951 ms4.1%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4841 ms4.1%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.1%
CursorWrapper._executedjango/db/backends/utils.py:1031 ms4.1%
Cursor.executepsycopg/cursor.py:1131 ms4.1%
Connection.waitpsycopg/connection.py:4951 ms4.1%
TestCase._fixture_teardowndjango/test/testcases.py:14971 ms4.1%
TestCase._rollback_atomicsdjango/test/testcases.py:14051 ms4.1%
Atomic.__exit__django/db/transaction.py:2861 ms4.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:261 ms4.1%
BaseDatabaseWrapper.savepoint_commitdjango/db/backends/base/base.py:4311 ms4.1%
BaseDatabaseWrapper._savepoint_commitdjango/db/backends/base/base.py:3751 ms4.1%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.1%
CursorWrapper._executedjango/db/backends/utils.py:1031 ms4.1%
Cursor.executepsycopg/cursor.py:1131 ms4.1%
Connection.waitpsycopg/connection.py:4951 ms4.1%
Estimated from 22 samples; phase durations are exact. Frames from pytest and pluggy are
hidden
.
Hot lines in your code
|
apps/projects/models.py:466
super().save(*args, **kwargs)
Profile.save
· Database
|
3 ms |
|
apps/projects/models.py:18
existing = model.objects.filter(project=project, **lookup).first()
get_or_create_numbered
· Database
|
3 ms |
|
apps/orgs/models.py:46
while slug in reserved or taken.filter(slug=slug).exists():
unique_slug
· Database
|
3 ms |
|
apps/projects/testing.py:64
project = Project.objects.create(
make_project
· Database
|
1 ms |
|
apps/projects/models.py:35
return (model.objects.filter(project_id=project_id).aggregate(last=models.Max("number"))["last"] or 0) + 1
next_number
· Database
|
1 ms |
|
apps/projects/models.py:23
with transaction.atomic():
get_or_create_numbered
· Database
|
1 ms |
Fixtures
Exact setup time| _unittest_setUpClass_fixture_SlugsAndNumbersTest class | 15 ms |
| _django_setup_unittest class | 0.25 ms |
| _dj_autoclear_mailbox function | 0.05 ms |
| _template_string_if_invalid_marker function | 0.03 ms |
| _django_db_marker function | 0.03 ms |
| _live_server_helper function | 0.03 ms |
| _django_set_urlconf function | 0.03 ms |
| _django_clear_site_cache function | 0.02 ms |
| monkeypatch function | 0.02 ms |
Database
24 queries · 10 ms
Repeated queries are usually N+1 lookups: fetch them once with select_related / prefetch_related (or selectinload).
3×
INSERT INTO "projects_profile" ("project_id", "number", "environment_id", "session_id", "run_id", "commit_id", "ingest_id", "external_id", "status", "error", "started_at", "duration", "exit_status", "backend", "rate", "samples", "workers", "flakytest_version", "python_version", "branch", "dirty", "…
Biggest pieces of work
|
setup setUpClass
django/test/testcases.py:1423
|
16 ms |
|
call test body
apps/projects/tests.py:1498
|
9 ms |
|
call _post_teardown
django/test/testcases.py:1240
|
2 ms |
Reliability
12 results · 0 CI failures · 0 local failuresThis test hasn't failed recently.
History
Latest 12 results, oldest first in the strip| When | Environment | Outcome | Duration | |
|---|---|---|---|---|
| 16 hours ago | CI github-actions:test | passed | 26 ms | Profile |
| 1 week, 5 days ago | CI github-actions:test | passed | 19 ms | Profile |
| 2 weeks, 1 day ago | CI github-actions:test | passed | 28 ms | Profile |
| 2 weeks, 1 day ago | CI github-actions:test | passed | 29 ms | Profile |
| 2 weeks, 1 day ago | CI github-actions:test | passed | 32 ms | Profile |
| 2 weeks, 2 days ago | CI github-actions:test | passed | 21 ms | Profile |
| 2 weeks, 4 days ago | CI github-actions:test | passed | 31 ms | Profile |
| 2 weeks, 6 days ago | CI github-actions:test | passed | 30 ms | Profile |
| 2 weeks, 6 days ago | CI github-actions:test | passed | 30 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 36 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 19 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 30 ms | Profile |