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

AnalyticsTest::test_single_test

First seen 9 hours ago in 78a4357
CI github-actions:test 5 runs
Average
24 ms
median 26 ms
max 27 ms
Phases
Setup 0.69 ms Call 23 ms Teardown 0.18 ms
Categories
Database 22 ms Other (Deep copies, Unsampled, pytest) 2 ms

16 database queries per run

Needs 10 KB of memory (max 16 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, 2 hours ago · open run
Hide pytest frames
setup0.86 ms3.3%
CallInfo.from_call_pytest/runner.py:3530.86 ms3.3%
call_and_report.<locals>.<lambda>_pytest/runner.py:2450.86 ms3.3%
HookCaller.__call__pluggy/_hooks.py:5120.86 ms3.3%
PluginManager._hookexecpluggy/_manager.py:1200.86 ms3.3%
_multicallpluggy/_callers.py:1210.86 ms3.3%
pytest_runtest_setup_pytest/runner.py:1650.86 ms3.3%
SetupState.setup_pytest/runner.py:5230.86 ms3.3%
TestCaseFunction.setup_pytest/unittest.py:2270.86 ms3.3%
Function.setup_pytest/python.py:17230.86 ms3.3%
TopRequest._fillfixtures_pytest/fixtures.py:7070.86 ms3.3%
FixtureRequest.getfixturevalue_pytest/fixtures.py:5390.86 ms3.3%
FixtureRequest._get_active_fixturedef_pytest/fixtures.py:6270.86 ms3.3%
FixtureDef.execute_pytest/fixtures.py:11100.86 ms3.3%
HookCaller.__call__pluggy/_hooks.py:5120.86 ms3.3%
call25 ms96.1%
CallInfo.from_call_pytest/runner.py:35325 ms96.1%
call_and_report.<locals>.<lambda>_pytest/runner.py:24525 ms96.1%
HookCaller.__call__pluggy/_hooks.py:51225 ms96.1%
PluginManager._hookexecpluggy/_manager.py:12025 ms96.1%
_multicallpluggy/_callers.py:12125 ms96.1%
pytest_runtest_call_pytest/runner.py:17925 ms96.1%
_django_setup_unittest.<locals>.non_debugging_runtestpytest_django/plugin.py:57325 ms96.1%
SimpleTestCase.__call__django/test/testcases.py:31325 ms96.1%
SimpleTestCase._setup_and_calldjango/test/testcases.py:36824 ms90.8%
TestCase.__call__<stdlib>/unittest/case.py:74724 ms90.8%
TestCase.run<stdlib>/unittest/case.py:69124 ms90.8%
TestCase._callTestMethod<stdlib>/unittest/case.py:63724 ms90.8%
AnalyticsTest.test_single_testapps/projects/tests.py:819 history = history_for_test(test)10 ms37.4%
history_for_testapps/projects/analytics.py:819 TestRun.objects.filter(test=test)4 ms16.0%
QuerySet.__iter__django/db/models/query.py:3904 ms16.0%
QuerySet._fetch_alldjango/db/models/query.py:20004 ms16.0%
ModelIterable.__iter__django/db/models/query.py:954 ms16.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16243 ms10.7%
CursorWrapper.executedjango/db/backends/utils.py:793 ms10.7%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:923 ms10.7%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1003 ms10.7%
CursorWrapper._executedjango/db/backends/utils.py:1053 ms10.7%
Cursor.executepsycopg/cursor.py:1133 ms10.7%
Connection.waitpsycopg/connection.py:4953 ms10.7%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms5.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7671 ms5.3%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:871 ms5.3%
SQLCompiler.get_order_bydjango/db/models/sql/compiler.py:4911 ms5.3%
SQLCompiler._order_by_pairsdjango/db/models/sql/compiler.py:3621 ms5.3%
history_for_testapps/projects/analytics.py:806 for perf in TestPerf.objects.filter(test=test)4 ms16.0%
QuerySet.__iter__django/db/models/query.py:3904 ms16.0%
QuerySet._fetch_alldjango/db/models/query.py:20004 ms16.0%
ModelIterable.__iter__django/db/models/query.py:954 ms16.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16243 ms10.7%
CursorWrapper.executedjango/db/backends/utils.py:793 ms10.7%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:923 ms10.7%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms5.3%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms5.3%
Cursor.executepsycopg/cursor.py:1131 ms5.3%
Connection.waitpsycopg/connection.py:4951 ms5.3%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1021 ms5.3%
QueryStats.addflakytest/profiling/dbtrack.py:381 ms5.3%
normalize_sqlflakytest/profiling/dbtrack.py:251 ms5.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms5.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7671 ms5.3%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:871 ms5.3%
SQLCompiler.get_order_bydjango/db/models/sql/compiler.py:4911 ms5.3%
SQLCompiler._order_by_pairsdjango/db/models/sql/compiler.py:3621 ms5.3%
Expression.__hash__django/db/models/expressions.py:5621 ms5.3%
cached_property.__get__django/utils/functional.py:471 ms5.3%
Expression.identitydjango/db/models/expressions.py:5431 ms5.3%
Signature.bind_partial<stdlib>/inspect.py:32601 ms5.3%
history_for_testapps/projects/analytics.py:820 .exclude(session__profile__testperf__test=test)1 ms5.3%
QuerySet.excludedjango/db/models/query.py:15501 ms5.3%
QuerySet._filter_or_excludedjango/db/models/query.py:15601 ms5.3%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:15681 ms5.3%
Query.add_qdjango/db/models/sql/query.py:16711 ms5.3%
Query._add_qdjango/db/models/sql/query.py:17031 ms5.3%
Query.build_filterdjango/db/models/sql/query.py:15771 ms5.3%
AnalyticsTest.test_single_testapps/projects/tests.py:8234 ms16.0%
resolve_scopeapps/projects/analytics.py:198 selected = Environment.objects.filter(project=project, name=env).first()1 ms5.3%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms5.3%
QuerySet.filterdjango/db/models/query.py:15421 ms5.3%
QuerySet._filter_or_excludedjango/db/models/query.py:15601 ms5.3%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:15701 ms5.3%
Query.add_qdjango/db/models/sql/query.py:16711 ms5.3%
Query._add_qdjango/db/models/sql/query.py:17031 ms5.3%
Query.build_filterdjango/db/models/sql/query.py:15771 ms5.3%
Query.setup_joinsdjango/db/models/sql/query.py:19771 ms5.3%
resolve_scopeapps/projects/analytics.py:206 environments=list(Environment.objects.filter(project=project, kind=env)),1 ms5.3%
QuerySet.__iter__django/db/models/query.py:3901 ms5.3%
QuerySet._fetch_alldjango/db/models/query.py:20001 ms5.3%
ModelIterable.__iter__django/db/models/query.py:951 ms5.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms5.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7671 ms5.3%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:871 ms5.3%
SQLCompiler.get_order_bydjango/db/models/sql/compiler.py:4911 ms5.3%
SQLCompiler._order_by_pairsdjango/db/models/sql/compiler.py:4741 ms5.3%
latest_perfapps/projects/analytics.py:846 return perfs.select_related("profile", "environment").order_by("-date").first()1 ms5.3%
QuerySet.firstdjango/db/models/query.py:11451 ms5.3%
QuerySet.__iter__django/db/models/query.py:3901 ms5.3%
QuerySet._fetch_alldjango/db/models/query.py:20001 ms5.3%
ModelIterable.__iter__django/db/models/query.py:951 ms5.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms5.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7951 ms5.3%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5781 ms5.3%
WhereNode.as_sqldjango/db/models/sql/where.py:1511 ms5.3%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5781 ms5.3%
RelatedIn.as_sqldjango/db/models/fields/related_lookups.py:951 ms5.3%
In.as_sqldjango/db/models/lookups.py:5561 ms5.3%
BuiltinLookup.as_sqldjango/db/models/lookups.py:2391 ms5.3%
In.process_rhsdjango/db/models/lookups.py:5401 ms5.3%
AnalyticsTest.test_single_testapps/projects/tests.py:8223 ms10.7%
latest_perfapps/projects/analytics.py:846 return perfs.select_related("profile", "environment").order_by("-date").first()3 ms10.7%
QuerySet.firstdjango/db/models/query.py:11453 ms10.7%
QuerySet.__iter__django/db/models/query.py:3903 ms10.7%
QuerySet._fetch_alldjango/db/models/query.py:20003 ms10.7%
ModelIterable.__iter__django/db/models/query.py:953 ms10.7%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms5.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7671 ms5.3%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:861 ms5.3%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:751 ms5.3%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3001 ms5.3%
SQLCompiler.get_related_selectionsdjango/db/models/sql/compiler.py:12661 ms5.3%
SQLCompiler.get_related_selectionsdjango/db/models/sql/compiler.py:12301 ms5.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms5.3%
CursorWrapper.executedjango/db/backends/utils.py:791 ms5.3%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms5.3%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms5.3%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms5.3%
Cursor.executepsycopg/cursor.py:1131 ms5.3%
Connection.waitpsycopg/connection.py:4951 ms5.3%
AnalyticsTest.test_single_testapps/projects/tests.py:8243 ms10.7%
resolve_scopeapps/projects/analytics.py:198 selected = Environment.objects.filter(project=project, name=env).first()1 ms5.3%
QuerySet.firstdjango/db/models/query.py:11451 ms5.3%
QuerySet.__iter__django/db/models/query.py:3901 ms5.3%
QuerySet._fetch_alldjango/db/models/query.py:20001 ms5.3%
ModelIterable.__iter__django/db/models/query.py:951 ms5.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms5.3%
CursorWrapper.executedjango/db/backends/utils.py:791 ms5.3%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms5.3%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms5.3%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms5.3%
Cursor.executepsycopg/cursor.py:1131 ms5.3%
Connection.waitpsycopg/connection.py:4951 ms5.3%
latest_perfapps/projects/analytics.py:846 return perfs.select_related("profile", "environment").order_by("-date").first()1 ms5.3%
QuerySet.firstdjango/db/models/query.py:11451 ms5.3%
QuerySet.__iter__django/db/models/query.py:3901 ms5.3%
QuerySet._fetch_alldjango/db/models/query.py:20001 ms5.3%
ModelIterable.__iter__django/db/models/query.py:951 ms5.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms5.3%
CursorWrapper.executedjango/db/backends/utils.py:791 ms5.3%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms5.3%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1021 ms5.3%
QueryStats.addflakytest/profiling/dbtrack.py:381 ms5.3%
normalize_sqlflakytest/profiling/dbtrack.py:231 ms5.3%
AnalyticsTest.test_single_testapps/projects/tests.py:812 test = Test.objects.get(project=self.project, name=self.slow)1 ms5.3%
TestData.__get__django/test/testcases.py:13671 ms5.3%
deepcopy<stdlib>/copy.py:1461 ms5.3%
AnalyticsTest.test_single_testapps/projects/tests.py:8131 ms5.3%
environment_stats_for_testapps/projects/analytics.py:748 for perf in TestPerf.objects.filter(test=test, date__gte=since).select_related("environment").order_by("date"):1 ms5.3%
QuerySet.__iter__django/db/models/query.py:3901 ms5.3%
QuerySet._fetch_alldjango/db/models/query.py:20001 ms5.3%
ModelIterable.__iter__django/db/models/query.py:951 ms5.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms5.3%
CursorWrapper.executedjango/db/backends/utils.py:791 ms5.3%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms5.3%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms5.3%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms5.3%
Cursor.executepsycopg/cursor.py:1131 ms5.3%
Connection.waitpsycopg/connection.py:4951 ms5.3%
AnalyticsTest.test_single_testapps/projects/tests.py:814 self.assertEqual([row["name"] for row in rows], [self.ci.name, self.local.name])1 ms5.3%
TestData.__get__django/test/testcases.py:13671 ms5.3%
deepcopy<stdlib>/copy.py:1571 ms5.3%
SimpleTestCase._setup_and_calldjango/test/testcases.py:3711 ms5.3%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()1 ms5.3%
TestCase._fixture_teardowndjango/test/testcases.py:14951 ms5.3%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4831 ms5.3%
CursorWrapper.executedjango/db/backends/utils.py:791 ms5.3%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms5.3%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms5.3%
CursorWrapper._executedjango/db/backends/utils.py:1031 ms5.3%
Cursor.executepsycopg/cursor.py:1131 ms5.3%
Connection.waitpsycopg/connection.py:4951 ms5.3%
Estimated from 19 samples; phase durations are exact. Frames from pytest and pluggy are shown .

Hot lines in your code

apps/projects/analytics.py:846
return perfs.select_related("profile", "environment").order_by("-date").first()
latest_perf · Database
6 ms
apps/projects/analytics.py:819
TestRun.objects.filter(test=test)
history_for_test · Database
4 ms
apps/projects/analytics.py:806
for perf in TestPerf.objects.filter(test=test)
history_for_test · Database
4 ms
apps/projects/analytics.py:198
selected = Environment.objects.filter(project=project, name=env).first()
resolve_scope · Database
3 ms
apps/projects/tests.py:812
test = Test.objects.get(project=self.project, name=self.slow)
AnalyticsTest.test_single_test · Deep copies
1 ms
apps/projects/analytics.py:748
for perf in TestPerf.objects.filter(test=test, date__gte=since).select_related("environment").order_by("date"):
environment_stats_for_test · Database
1 ms
apps/projects/tests.py:814
self.assertEqual([row["name"] for row in rows], [self.ci.name, self.local.name])
AnalyticsTest.test_single_test · Deep copies
1 ms
apps/projects/analytics.py:820
.exclude(session__profile__testperf__test=test)
history_for_test · Database
1 ms
apps/projects/analytics.py:206
environments=list(Environment.objects.filter(project=project, kind=env)),
resolve_scope · Database
1 ms

Fixtures

Exact setup time
_django_db_marker function 0.05 ms
_dj_autoclear_mailbox function 0.04 ms
_template_string_if_invalid_marker function 0.04 ms
_django_clear_site_cache function 0.04 ms
_django_set_urlconf function 0.03 ms
_live_server_helper function 0.03 ms
monkeypatch function 0.02 ms

Database

16 queries · 10 ms

Repeated queries are usually N+1 lookups: fetch them once with select_related / prefetch_related (or selectinload).

5×
SELECT "projects_testperf"."id", "projects_testperf"."project_id", "projects_testperf"."test_id", "projects_testperf"."profile_id", "projects_testperf"."part", "projects_testperf"."environment_id", "projects_testperf"."outcome", "projects_testperf"."duration", "projects_testperf"."setup", "projects…
4×
SELECT "projects_environment"."id", "projects_environment"."project_id", "projects_environment"."name", "projects_environment"."kind", "projects_environment"."provider", "projects_environment"."details", "projects_environment"."date_first_seen", "projects_environment"."date_last_seen" FROM "project…

Biggest pieces of work

call test body
apps/projects/tests.py:819
24 ms
call _post_teardown
django/test/testcases.py:1240
1 ms
setup pytest internals 0.86 ms

Reliability

5 results · 0 CI failures · 0 local failures

This test hasn't failed recently.

History

Latest 5 results, oldest first in the strip
When Environment Outcome Duration Commit
2 hours ago CI github-actions:test passed 26 ms 9caa567 main Profile
2 hours ago CI github-actions:test passed 26 ms ec75501 main Profile
9 hours ago CI github-actions:test passed 27 ms d2c12e5 main Profile
9 hours ago CI github-actions:test passed 16 ms 0b902f6 main Profile
9 hours ago CI github-actions:test passed 27 ms 78a4357 main Profile