Tests / apps/projects/tests.py
SlugsAndNumbersTest::test_a_taken_number_is_retried
First seen 8 hours ago in 78a4357
CI
github-actions:test
5 runs
Average
29 ms
median 30 ms
max 36 ms
max 36 ms
Phases
Setup 17 ms
Call 12 ms
Teardown 0.15 ms
Categories
Database 27 ms
Factories 0.30 ms
Other (pytest, Unsampled) 2 ms
24 database queries per run
Needs 0 KB of memory (max 0 KB)
Duration per run
Where the time goes
Latest run in ci:github-actions:test, an hour ago ·
open run
setup18 ms58.7%
CallInfo.from_call_pytest/runner.py:35318 ms58.7%
call_and_report.<locals>.<lambda>_pytest/runner.py:24518 ms58.7%
HookCaller.__call__pluggy/_hooks.py:51218 ms58.7%
PluginManager._hookexecpluggy/_manager.py:12018 ms58.7%
_multicallpluggy/_callers.py:12116 ms54.5%
pytest_runtest_setup_pytest/runner.py:16516 ms54.5%
SetupState.setup_pytest/runner.py:52316 ms54.5%
TestCaseFunction.setup_pytest/unittest.py:22716 ms54.5%
Function.setup_pytest/python.py:172316 ms54.5%
TopRequest._fillfixtures_pytest/fixtures.py:70716 ms54.5%
FixtureRequest.getfixturevalue_pytest/fixtures.py:53916 ms54.5%
FixtureRequest._get_active_fixturedef_pytest/fixtures.py:62716 ms54.5%
FixtureDef.execute_pytest/fixtures.py:111016 ms54.5%
HookCaller.__call__pluggy/_hooks.py:51216 ms54.5%
PluginManager._hookexecpluggy/_manager.py:12016 ms54.5%
_multicallpluggy/_callers.py:12116 ms54.5%
pytest_fixture_setup_pytest/fixtures.py:120216 ms54.5%
call_fixture_func_pytest/fixtures.py:90816 ms54.5%
UnitTestCase._register_unittest_setup_class_fixture.<locals>.unittest_setup_class_fixture_pytest/unittest.py:15416 ms54.5%
TestCase.setUpClassdjango/test/testcases.py:1423 cls.cls_atomics = cls._enter_atomics()11 ms37.7%
TestCase._enter_atomicsdjango/test/testcases.py:139611 ms37.7%
Atomic.__enter__django/db/transaction.py:19811 ms37.7%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:45411 ms37.7%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:30311 ms37.7%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:2611 ms37.7%
BaseDatabaseWrapper.ensure_connectiondjango/db/backends/base/base.py:27911 ms37.7%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:2611 ms37.7%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:25610 ms33.6%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:2610 ms33.6%
DatabaseWrapper.get_new_connectiondjango/db/backends/postgresql/base.py:33310 ms33.6%
Connection.connectpsycopg/connection.py:10910 ms33.6%
wait_connpsycopg/waiting.py:1456 ms21.0%
BaseConnection._connect_genpsycopg/_connection_base.py:4396 ms21.0%
wait_connpsycopg/waiting.py:1414 ms12.6%
EpollSelector.select<stdlib>/selectors.py:4524 ms12.6%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2581 ms4.2%
DatabaseWrapper.init_connection_statedjango/db/backends/postgresql/base.py:4021 ms4.2%
DatabaseWrapper._configure_connectiondjango/db/backends/postgresql/base.py:3741 ms4.2%
DatabaseWrapper._configure_timezonedjango/db/backends/postgresql/base.py:3571 ms4.2%
Cursor.executepsycopg/cursor.py:1131 ms4.2%
Connection.waitpsycopg/connection.py:4951 ms4.2%
TestCase.setUpClassdjango/test/testcases.py:1439 cls.setUpTestData()5 ms16.8%
SlugsAndNumbersTest.setUpTestDataapps/projects/tests.py:14284 ms12.6%
make_projectapps/projects/testing.py:621 ms4.2%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.2%
QuerySet.existsdjango/db/models/query.py:13371 ms4.2%
Query.has_resultsdjango/db/models/sql/query.py:6811 ms4.2%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15921 ms4.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms4.2%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.2%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms4.2%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.2%
Cursor.executepsycopg/cursor.py:1131 ms4.2%
Connection.waitpsycopg/connection.py:4951 ms4.2%
make_projectapps/projects/testing.py:67 slug=unique_slug(name, organization.project_set.all(), fallback="project", reserved=RESERVED_PROJECT_SLUGS),1 ms4.2%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.2%
QuerySet.filterdjango/db/models/query.py:15411 ms4.2%
QuerySet._not_support_combined_queriesdjango/db/models/query.py:20741 ms4.2%
QuerySet.querydjango/db/models/query.py:3061 ms4.2%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:15701 ms4.2%
make_projectapps/projects/testing.py:64 project = Project.objects.create(1 ms4.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms4.2%
QuerySet.createdjango/db/models/query.py:6691 ms4.2%
Model.savedjango/db/models/base.py:8741 ms4.2%
Model.save_basedjango/db/models/base.py:9661 ms4.2%
Model._save_tabledjango/db/models/base.py:11671 ms4.2%
Model._do_insertdjango/db/models/base.py:12181 ms4.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms4.2%
QuerySet._insertdjango/db/models/query.py:19181 ms4.2%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19251 ms4.2%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.2%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms4.2%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.2%
Cursor.executepsycopg/cursor.py:1131 ms4.2%
Connection.waitpsycopg/connection.py:4951 ms4.2%
BaseCursor._execute_genpsycopg/_cursor_base.py:2061 ms4.2%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2861 ms4.2%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:781 ms4.2%
SlugsAndNumbersTest.setUpTestDataapps/projects/tests.py:14271 ms4.2%
make_projectapps/projects/testing.py:621 ms4.2%
unique_slugapps/orgs/models.py:46 while slug in reserved or taken.filter(slug=slug).exists():1 ms4.2%
QuerySet.existsdjango/db/models/query.py:13371 ms4.2%
Query.has_resultsdjango/db/models/sql/query.py:6811 ms4.2%
SQLCompiler.has_resultsdjango/db/models/sql/compiler.py:15921 ms4.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms4.2%
CursorWrapper.executedjango/db/backends/utils.py:791 ms4.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms4.2%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms4.2%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms4.2%
Cursor.executepsycopg/cursor.py:1131 ms4.2%
Connection.waitpsycopg/connection.py:4951 ms4.2%
_multicallpluggy/_callers.py:1521 ms4.2%
CaptureManager.pytest_runtest_setup_pytest/capture.py:8941 ms4.2%
_GeneratorContextManager.__exit__<stdlib>/contextlib.py:2101 ms4.2%
CaptureManager.item_capture_pytest/capture.py:8671 ms4.2%
CaptureManager.read_global_capture_pytest/capture.py:8031 ms4.2%
MultiCapture.readouterr_pytest/capture.py:7061 ms4.2%
FDCapture.snap_pytest/capture.py:5921 ms4.2%
call12 ms40.8%
CallInfo.from_call_pytest/runner.py:35312 ms40.8%
call_and_report.<locals>.<lambda>_pytest/runner.py:24512 ms40.8%
HookCaller.__call__pluggy/_hooks.py:51212 ms40.8%
PluginManager._hookexecpluggy/_manager.py:12012 ms40.8%
_multicallpluggy/_callers.py:12112 ms40.8%
pytest_runtest_call_pytest/runner.py:17912 ms40.8%
_django_setup_unittest.<locals>.non_debugging_runtestpytest_django/plugin.py:57312 ms40.8%
SimpleTestCase.__call__django/test/testcases.py:31312 ms40.8%
SimpleTestCase._setup_and_calldjango/test/testcases.py:36811 ms35.7%
TestCase.__call__<stdlib>/unittest/case.py:74711 ms35.7%
TestCase.run<stdlib>/unittest/case.py:69111 ms35.7%
TestCase._callTestMethod<stdlib>/unittest/case.py:63711 ms35.7%
SlugsAndNumbersTest.test_a_taken_number_is_retriedapps/projects/tests.py:14626 ms20.4%
get_or_create_numberedapps/projects/models.py:23 with transaction.atomic():3 ms10.2%
Atomic.__exit__django/db/transaction.py:2832 ms5.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms5.1%
BaseDatabaseWrapper.savepoint_rollbackdjango/db/backends/base/base.py:4132 ms5.1%
BaseDatabaseWrapper._savepoint_rollbackdjango/db/backends/base/base.py:3712 ms5.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms5.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms5.1%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms5.1%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms5.1%
Cursor.executepsycopg/cursor.py:1132 ms5.1%
Connection.waitpsycopg/connection.py:4952 ms5.1%
Atomic.__enter__django/db/transaction.py:2112 ms5.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms5.1%
BaseDatabaseWrapper.savepointdjango/db/backends/base/base.py:4002 ms5.1%
BaseDatabaseWrapper._savepointdjango/db/backends/base/base.py:3672 ms5.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms5.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms5.1%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms5.1%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms5.1%
Cursor.executepsycopg/cursor.py:1132 ms5.1%
Connection.waitpsycopg/connection.py:4952 ms5.1%
get_or_create_numberedapps/projects/models.py:18 existing = model.objects.filter(project=project, **lookup).first()2 ms5.1%
QuerySet.firstdjango/db/models/query.py:11452 ms5.1%
QuerySet.__iter__django/db/models/query.py:3902 ms5.1%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms5.1%
ModelIterable.__iter__django/db/models/query.py:952 ms5.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms5.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms5.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms5.1%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms5.1%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms5.1%
Cursor.executepsycopg/cursor.py:1132 ms5.1%
Connection.waitpsycopg/connection.py:4952 ms5.1%
get_or_create_numberedapps/projects/models.py:24 return model.objects.create(project=project, number=number, **lookup, **(defaults or {})), True2 ms5.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms5.1%
QuerySet.createdjango/db/models/query.py:6692 ms5.1%
Profile.saveapps/projects/models.py:466 super().save(*args, **kwargs)2 ms5.1%
Model.savedjango/db/models/base.py:8742 ms5.1%
Model.save_basedjango/db/models/base.py:9662 ms5.1%
Model._save_tabledjango/db/models/base.py:11672 ms5.1%
Model._do_insertdjango/db/models/base.py:12182 ms5.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms5.1%
QuerySet._insertdjango/db/models/query.py:19182 ms5.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19242 ms5.1%
SQLInsertCompiler.as_sqldjango/db/models/sql/compiler.py:18492 ms5.1%
SlugsAndNumbersTest.test_a_taken_number_is_retriedapps/projects/tests.py:1460 baker.make(Profile, project=self.project)5 ms15.3%
makemodel_bakery/baker.py:1475 ms15.3%
Baker.makemodel_bakery/baker.py:4065 ms15.3%
Baker._makemodel_bakery/baker.py:4825 ms15.3%
Baker.instancemodel_bakery/baker.py:5355 ms15.3%
Profile.saveapps/projects/models.py:465 self.number = next_number(type(self), self.project_id)3 ms10.2%
next_numberapps/projects/models.py:35 return (model.objects.filter(project_id=project_id).aggregate(last=models.Max("number"))["last"] or 0) + 12 ms5.1%
QuerySet.aggregatedjango/db/models/query.py:5942 ms5.1%
Query.get_aggregationdjango/db/models/sql/query.py:6332 ms5.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms5.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms5.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms5.1%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms5.1%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms5.1%
Cursor.executepsycopg/cursor.py:1132 ms5.1%
Connection.waitpsycopg/connection.py:4952 ms5.1%
Profile.saveapps/projects/models.py:466 super().save(*args, **kwargs)2 ms5.1%
Model.savedjango/db/models/base.py:8742 ms5.1%
Model.save_basedjango/db/models/base.py:9662 ms5.1%
Model._save_tabledjango/db/models/base.py:11672 ms5.1%
Model._do_insertdjango/db/models/base.py:12182 ms5.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms5.1%
QuerySet._insertdjango/db/models/query.py:19182 ms5.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19252 ms5.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms5.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms5.1%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms5.1%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms5.1%
Cursor.executepsycopg/cursor.py:1132 ms5.1%
Connection.waitpsycopg/connection.py:4952 ms5.1%
SimpleTestCase._setup_and_calldjango/test/testcases.py:3712 ms5.1%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()2 ms5.1%
TestCase._fixture_teardowndjango/test/testcases.py:14952 ms5.1%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4832 ms5.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms5.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms5.1%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms5.1%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms5.1%
Cursor.executepsycopg/cursor.py:1132 ms5.1%
Connection.waitpsycopg/connection.py:4952 ms5.1%
Estimated from 22 samples; phase durations are exact. Frames from pytest and pluggy are
shown
.
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/projects/models.py:466
super().save(*args, **kwargs)
Profile.save
· Database
|
3 ms |
|
apps/projects/models.py:23
with transaction.atomic():
get_or_create_numbered
· Database
|
3 ms |
|
apps/projects/models.py:465
self.number = next_number(type(self), self.project_id)
Profile.save
· 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:18
existing = model.objects.filter(project=project, **lookup).first()
get_or_create_numbered
· Database
|
2 ms |
|
apps/projects/testing.py:64
project = Project.objects.create(
make_project
· Database
|
1 ms |
Fixtures
Exact setup time| _unittest_setUpClass_fixture_SlugsAndNumbersTest class | 16 ms |
| _django_setup_unittest class | 0.32 ms |
| _django_db_marker function | 0.04 ms |
| _template_string_if_invalid_marker function | 0.04 ms |
| _dj_autoclear_mailbox function | 0.04 ms |
| _live_server_helper function | 0.03 ms |
| _django_set_urlconf function | 0.03 ms |
| _django_clear_site_cache function | 0.03 ms |
| monkeypatch function | 0.02 ms |
Database
24 queries · 11 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:1460
|
11 ms |
|
call _post_teardown
django/test/testcases.py:1240
|
2 ms |
| setup pytest internals | 1 ms |
Reliability
5 results · 0 CI failures · 0 local failuresThis test hasn't failed recently.
History
Latest 5 results, oldest first in the strip| When | Environment | Outcome | Duration | |
|---|---|---|---|---|
| an hour ago | CI github-actions:test | passed | 30 ms | Profile |
| an hour ago | CI github-actions:test | passed | 30 ms | Profile |
| 8 hours ago | CI github-actions:test | passed | 36 ms | Profile |
| 8 hours ago | CI github-actions:test | passed | 19 ms | Profile |
| 9 hours ago | CI github-actions:test | passed | 30 ms | Profile |