Tests / apps/projects/tests.py
SlugsAndNumbersTest::test_a_taken_number_is_retried
First seen 1 month, 1 week ago in 78a4357
CI
github-actions:test
15 runs
Average
27 ms
median 29 ms
max 36 ms
max 36 ms
Phases
Setup 16 ms
Call 11 ms
Teardown 0.14 ms
Categories
Database 25 ms
Factories 0.20 ms
Other (pytest, Unsampled, Mocking, Libraries) 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, 2 weeks ago ·
open run
setup14 ms59.7%
TestCase.setUpClassdjango/test/testcases.py:1423 cls.cls_atomics = cls._enter_atomics()9 ms36.7%
TestCase._enter_atomicsdjango/test/testcases.py:13969 ms36.7%
Atomic.__enter__django/db/transaction.py:1989 ms36.7%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:4549 ms36.7%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:3039 ms36.7%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms36.7%
BaseDatabaseWrapper.ensure_connectiondjango/db/backends/base/base.py:2799 ms36.7%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms36.7%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2567 ms32.1%
DatabaseWrapper.get_new_connectionft/db/postgresql/base.py:39 return super().get_new_connection(conn_params)7 ms32.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:267 ms32.1%
DatabaseWrapper.get_new_connectiondjango/db/backends/postgresql/base.py:3337 ms32.1%
Connection.connectpsycopg/connection.py:1096 ms27.5%
wait_connpsycopg/waiting.py:1414 ms18.4%
EpollSelector.select<stdlib>/selectors.py:4524 ms18.4%
wait_connpsycopg/waiting.py:1452 ms9.2%
BaseConnection._connect_genpsycopg/_connection_base.py:4392 ms9.2%
Connection.connectpsycopg/connection.py:1001 ms4.6%
conninfo_attemptspsycopg/_conninfo_attempts.py:451 ms4.6%
_resolve_hostnamespsycopg/_conninfo_attempts.py:1021 ms4.6%
getaddrinfo<stdlib>/socket.py:9981 ms4.6%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2581 ms4.6%
DatabaseWrapper.init_connection_statedjango/db/backends/postgresql/base.py:4021 ms4.6%
DatabaseWrapper._configure_connectiondjango/db/backends/postgresql/base.py:3741 ms4.6%
DatabaseWrapper._configure_timezonedjango/db/backends/postgresql/base.py:3571 ms4.6%
Cursor.executepsycopg/cursor.py:1131 ms4.6%
Connection.waitpsycopg/connection.py:4951 ms4.6%
TestCase.setUpClassdjango/test/testcases.py:1439 cls.setUpTestData()4 ms18.4%
SlugsAndNumbersTest.setUpTestDataapps/projects/tests.py:14813 ms13.8%
make_projectapps/projects/testing.py:621 ms4.6%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.6%
QuerySet.existsdjango/db/models/query.py:13371 ms4.6%
Query.has_resultsdjango/db/models/sql/query.py:6811 ms4.6%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15921 ms4.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms4.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.6%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.6%
Cursor.executepsycopg/cursor.py:1131 ms4.6%
Connection.waitpsycopg/connection.py:4951 ms4.6%
make_projectapps/projects/testing.py:61 organization = Organization.objects.create(1 ms4.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms4.6%
QuerySet.createdjango/db/models/query.py:6691 ms4.6%
Model.savedjango/db/models/base.py:8741 ms4.6%
Model.save_basedjango/db/models/base.py:9661 ms4.6%
Model._save_tabledjango/db/models/base.py:11671 ms4.6%
Model._do_insertdjango/db/models/base.py:12181 ms4.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms4.6%
QuerySet._insertdjango/db/models/query.py:19181 ms4.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19251 ms4.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.6%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.6%
Cursor.executepsycopg/cursor.py:1131 ms4.6%
Connection.waitpsycopg/connection.py:4951 ms4.6%
make_projectapps/projects/testing.py:671 ms4.6%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.6%
QuerySet.existsdjango/db/models/query.py:13371 ms4.6%
Query.has_resultsdjango/db/models/sql/query.py:6811 ms4.6%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15921 ms4.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms4.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.6%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.6%
Cursor.executepsycopg/cursor.py:1131 ms4.6%
Connection.waitpsycopg/connection.py:4951 ms4.6%
SlugsAndNumbersTest.setUpTestDataapps/projects/tests.py:14821 ms4.6%
make_projectapps/projects/testing.py:621 ms4.6%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.6%
QuerySet.existsdjango/db/models/query.py:13371 ms4.6%
Query.has_resultsdjango/db/models/sql/query.py:6811 ms4.6%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15921 ms4.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms4.6%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7951 ms4.6%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5781 ms4.6%
WhereNode.as_sqldjango/db/models/sql/where.py:1511 ms4.6%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5781 ms4.6%
Exact.as_sqldjango/db/models/lookups.py:4071 ms4.6%
BuiltinLookup.as_sqldjango/db/models/lookups.py:2381 ms4.6%
BuiltinLookup.process_lhsdjango/db/models/lookups.py:2301 ms4.6%
Lookup.process_lhsdjango/db/models/lookups.py:1091 ms4.6%
__init____init__:-11 ms4.6%
signature<stdlib>/inspect.py:33431 ms4.6%
Signature.from_callable<stdlib>/inspect.py:30581 ms4.6%
_signature_from_callable<stdlib>/inspect.py:25281 ms4.6%
_signature_from_function<stdlib>/inspect.py:23511 ms4.6%
call9 ms39.8%
SlugsAndNumbersTest.test_a_taken_number_is_retriedapps/projects/tests.py:1514 baker.make(Profile, project=self.project)5 ms19.9%
makemodel_bakery/baker.py:1475 ms19.9%
Baker.makemodel_bakery/baker.py:4065 ms19.9%
Baker._makemodel_bakery/baker.py:4433 ms13.3%
Baker._skip_fieldmodel_bakery/baker.py:6302 ms6.6%
Baker.instancemodel_bakery/baker.py:5352 ms6.6%
Profile.saveapps/projects/models.py:465 self.number = next_number(type(self), self.project_id)2 ms6.6%
next_numberapps/projects/models.py:35 return (model.objects.filter(project_id=project_id).aggregate(last=models.Max("number"))["last"] or 0) + 12 ms6.6%
QuerySet.aggregatedjango/db/models/query.py:5942 ms6.6%
Query.get_aggregationdjango/db/models/sql/query.py:6332 ms6.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms6.6%
CursorWrapper.executedjango/db/backends/utils.py:792 ms6.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms6.6%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms6.6%
Cursor.executepsycopg/cursor.py:1132 ms6.6%
Connection.waitpsycopg/connection.py:4952 ms6.6%
Baker._makemodel_bakery/baker.py:4822 ms6.6%
Baker.instancemodel_bakery/baker.py:5352 ms6.6%
Profile.saveapps/projects/models.py:466 super().save(*args, **kwargs)2 ms6.6%
Model.savedjango/db/models/base.py:8742 ms6.6%
Model.save_basedjango/db/models/base.py:9662 ms6.6%
Model._save_tabledjango/db/models/base.py:11672 ms6.6%
Model._do_insertdjango/db/models/base.py:12182 ms6.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms6.6%
QuerySet._insertdjango/db/models/query.py:19182 ms6.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19252 ms6.6%
CursorWrapper.executedjango/db/backends/utils.py:792 ms6.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms6.6%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms6.6%
Cursor.executepsycopg/cursor.py:1132 ms6.6%
Connection.waitpsycopg/connection.py:4952 ms6.6%
SlugsAndNumbersTest.test_a_taken_number_is_retriedapps/projects/tests.py:15163 ms13.3%
get_or_create_numberedapps/projects/models.py:24 return model.objects.create(project=project, number=number, **lookup, **(defaults or {})), True2 ms6.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms6.6%
QuerySet.createdjango/db/models/query.py:6692 ms6.6%
Profile.saveapps/projects/models.py:466 super().save(*args, **kwargs)2 ms6.6%
Model.savedjango/db/models/base.py:8742 ms6.6%
Model.save_basedjango/db/models/base.py:9662 ms6.6%
Model._save_tabledjango/db/models/base.py:11672 ms6.6%
Model._do_insertdjango/db/models/base.py:12182 ms6.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms6.6%
QuerySet._insertdjango/db/models/query.py:19182 ms6.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19232 ms6.6%
get_or_create_numberedapps/projects/models.py:23 with transaction.atomic():2 ms6.6%
Atomic.__exit__django/db/transaction.py:2832 ms6.6%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms6.6%
BaseDatabaseWrapper.savepoint_rollbackdjango/db/backends/base/base.py:4132 ms6.6%
BaseDatabaseWrapper._savepoint_rollbackdjango/db/backends/base/base.py:3712 ms6.6%
CursorWrapper.executedjango/db/backends/utils.py:792 ms6.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms6.6%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms6.6%
Cursor.executepsycopg/cursor.py:1132 ms6.6%
Connection.waitpsycopg/connection.py:4952 ms6.6%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()2 ms6.6%
TestCase._fixture_teardowndjango/test/testcases.py:14952 ms6.6%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4832 ms6.6%
CursorWrapper.executedjango/db/backends/utils.py:792 ms6.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms6.6%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms6.6%
Cursor.executepsycopg/cursor.py:1132 ms6.6%
Connection.waitpsycopg/connection.py:4952 ms6.6%
Estimated from 19 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/models.py:46
while slug in reserved or taken.filter(slug=slug).exists():
unique_slug
· Database
|
3 ms |
|
apps/projects/models.py:466
super().save(*args, **kwargs)
Profile.save
· Database
|
3 ms |
|
apps/projects/tests.py:1514
baker.make(Profile, project=self.project)
SlugsAndNumbersTest.test_a_taken_number_is_retried
· Factories
|
2 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
|
2 ms |
|
apps/projects/models.py:23
with transaction.atomic():
get_or_create_numbered
· Database
|
2 ms |
|
apps/projects/testing.py:61
organization = Organization.objects.create(
make_project
· Database
|
1 ms |
Fixtures
Exact setup time| _unittest_setUpClass_fixture_SlugsAndNumbersTest class | 13 ms |
| _django_setup_unittest class | 0.15 ms |
| _template_string_if_invalid_marker function | 0.06 ms |
| _django_db_marker function | 0.05 ms |
| _dj_autoclear_mailbox function | 0.04 ms |
| _django_set_urlconf 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
24 queries · 8 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
|
13 ms |
|
call test body
apps/projects/tests.py:1514
|
8 ms |
|
call _post_teardown
django/test/testcases.py:1240
|
2 ms |
|
setup __init__
__init__:-1
|
1 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 | 23 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 | 19 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 26 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 19 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 28 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 29 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 32 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 21 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 31 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 30 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 30 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 36 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 19 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 30 ms | Profile |