flakytest.dev anze3db fedidevs
Tests / stats/tests.py

TestStats::test_store_daily_stats_with_accounts

First seen 2 years, 10 months ago in 1cd3a8d
CI github-actions:test 4 runs
Average
218 ms
median 234 ms
max 322 ms
Phases
Setup 10 ms Call 206 ms Teardown 3 ms
Categories
Database 211 ms App code 0.88 ms Other (pytest, Unsampled) 6 ms

104 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, 8 hours ago · open run
Hide pytest frames
setup0.86 ms1.0%
CallInfo.from_call_pytest/runner.py:3610.86 ms1.0%
call_and_report.<locals>.<lambda>_pytest/runner.py:2500.86 ms1.0%
HookCaller.__call__pluggy/_hooks.py:5120.86 ms1.0%
PluginManager._hookexecpluggy/_manager.py:1200.86 ms1.0%
_multicallpluggy/_callers.py:1210.86 ms1.0%
pytest_runtest_setup_pytest/runner.py:1700.86 ms1.0%
SetupState.setup_pytest/runner.py:5360.86 ms1.0%
TestCaseFunction.setup_pytest/unittest.py:2480.86 ms1.0%
Function.setup_pytest/python.py:17100.86 ms1.0%
TopRequest._fillfixtures_pytest/fixtures.py:8060.86 ms1.0%
FixtureRequest.getfixturevalue_pytest/fixtures.py:6300.86 ms1.0%
FixtureRequest._get_active_fixturedef_pytest/fixtures.py:7260.86 ms1.0%
FixtureDef.execute_pytest/fixtures.py:12320.86 ms1.0%
HookCaller.__call__pluggy/_hooks.py:5120.86 ms1.0%
PluginManager._hookexecpluggy/_manager.py:1200.86 ms1.0%
_multicallpluggy/_callers.py:1070.86 ms1.0%
run_old_style_hookwrapperpluggy/_callers.py:340.86 ms1.0%
pytest_fixture_setupanyio/pytest_plugin.py:1710.86 ms1.0%
call79 ms95.0%
CallInfo.from_call_pytest/runner.py:36179 ms95.0%
call_and_report.<locals>.<lambda>_pytest/runner.py:25079 ms95.0%
HookCaller.__call__pluggy/_hooks.py:51279 ms95.0%
PluginManager._hookexecpluggy/_manager.py:12079 ms95.0%
_multicallpluggy/_callers.py:12179 ms95.0%
pytest_runtest_call_pytest/runner.py:18479 ms95.0%
_django_setup_unittest.<locals>.non_debugging_runtestpytest_django/plugin.py:61479 ms95.0%
SimpleTestCase.__call__django/test/testcases.py:31479 ms95.0%
SimpleTestCase._setup_and_calldjango/test/testcases.py:36977 ms93.5%
TestCase.__call__<stdlib>/unittest/case.py:74777 ms93.5%
TestCase.run<stdlib>/unittest/case.py:69177 ms93.5%
TestCase._callTestMethod<stdlib>/unittest/case.py:63777 ms93.5%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:60 store_daily_stats()73 ms88.8%
store_daily_statsstats/models.py:20 ).count()36 ms43.6%
QuerySet.countdjango/db/models/query.py:67736 ms43.6%
Query.get_countdjango/db/models/sql/query.py:65736 ms43.6%
Query.get_aggregationdjango/db/models/sql/query.py:63934 ms40.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:162534 ms40.5%
CursorWrapper.executedjango/db/backends/utils.py:7934 ms40.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9234 ms40.5%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:10032 ms38.9%
CursorWrapper._executedjango/db/backends/utils.py:10532 ms38.9%
Cursor.executepsycopg/cursor.py:11332 ms38.9%
Connection.waitpsycopg/connection.py:49532 ms38.9%
BaseCursor._execute_genpsycopg/_cursor_base.py:20624 ms29.6%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28623 ms28.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7823 ms28.0%
BaseCursor._convert_querypsycopg/_cursor_base.py:4651 ms1.6%
PostgresClientQuery.convertpsycopg/_queries.py:2891 ms1.6%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1021 ms1.6%
QueryStats.addflakytest/profiling/dbtrack.py:381 ms1.6%
normalize_sqlflakytest/profiling/dbtrack.py:241 ms1.6%
Query.get_aggregationdjango/db/models/sql/query.py:4911 ms1.6%
Expression.__hash__django/db/models/expressions.py:5621 ms1.6%
Query.get_aggregationdjango/db/models/sql/query.py:6381 ms1.6%
store_daily_statsstats/models.py:12 f"{lang.code}_accounts": AccountLookup.objects.filter(language__icontains=lang.code + "\n").count()32 ms38.9%
QuerySet.countdjango/db/models/query.py:67728 ms34.3%
Query.get_countdjango/db/models/sql/query.py:65727 ms32.7%
Query.get_aggregationdjango/db/models/sql/query.py:63927 ms32.7%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:162519 ms23.4%
CursorWrapper.executedjango/db/backends/utils.py:7919 ms23.4%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9219 ms23.4%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:10019 ms23.4%
CursorWrapper._executedjango/db/backends/utils.py:10519 ms23.4%
Cursor.executepsycopg/cursor.py:11319 ms23.4%
Connection.waitpsycopg/connection.py:49519 ms23.4%
BaseCursor._execute_genpsycopg/_cursor_base.py:20614 ms17.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28614 ms17.1%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7814 ms17.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2051 ms1.6%
BaseCursor._convert_querypsycopg/_cursor_base.py:4651 ms1.6%
PostgresClientQuery.convertpsycopg/_queries.py:2891 ms1.6%
PostgresClientQuery.dumppsycopg/_queries.py:2991 ms1.6%
PostgresClientQuery.dump.<locals>.<genexpr>psycopg/_queries.py:3001 ms1.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16125 ms6.2%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7963 ms3.1%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5793 ms3.1%
WhereNode.as_sqldjango/db/models/sql/where.py:1513 ms3.1%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5793 ms3.1%
BuiltinLookup.as_sqldjango/db/models/lookups.py:2431 ms1.6%
BuiltinLookup.process_lhsdjango/db/models/lookups.py:2351 ms1.6%
Lookup.process_lhsdjango/db/models/lookups.py:1101 ms1.6%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5791 ms1.6%
BuiltinLookup.as_sqldjango/db/models/lookups.py:2441 ms1.6%
PatternLookup.process_rhsdjango/db/models/lookups.py:6051 ms1.6%
PatternLookup.is_simple_lookupdjango/db/models/lookups.py:6191 ms1.6%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:9821 ms1.6%
Query.reset_refcountsdjango/db/models/sql/query.py:9981 ms1.6%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7681 ms1.6%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:891 ms1.6%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:781 ms1.6%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3191 ms1.6%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5791 ms1.6%
Aggregate.as_sqldjango/db/models/aggregates.py:2121 ms1.6%
Func.as_sqldjango/db/models/expressions.py:11111 ms1.6%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5751 ms1.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16231 ms1.6%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:261 ms1.6%
BaseDatabaseWrapper.cursordjango/db/backends/base/base.py:3201 ms1.6%
BaseDatabaseWrapper._cursordjango/db/backends/base/base.py:2981 ms1.6%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:261 ms1.6%
DatabaseWrapper.create_cursordjango/db/backends/postgresql/base.py:4421 ms1.6%
Connection.cursorpsycopg/connection.py:2591 ms1.6%
Cursor.__init__psycopg/cursor.py:471 ms1.6%
BaseCursor.__init__psycopg/_cursor_base.py:651 ms1.6%
BaseConnection.adapterspsycopg/_connection_base.py:2771 ms1.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16441 ms1.6%
Query.get_countdjango/db/models/sql/query.py:6561 ms1.6%
Query.clonedjango/db/models/sql/query.py:3981 ms1.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:874 ms4.7%
QuerySet.filterdjango/db/models/query.py:16763 ms3.1%
QuerySet._filter_or_excludedjango/db/models/query.py:16943 ms3.1%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:17043 ms3.1%
Query.add_qdjango/db/models/sql/query.py:16811 ms1.6%
Query._add_qdjango/db/models/sql/query.py:17131 ms1.6%
Query.build_filterdjango/db/models/sql/query.py:15601 ms1.6%
Query.resolve_lookup_valuedjango/db/models/sql/query.py:13241 ms1.6%
BaseManager.get_querysetdjango/db/models/manager.py:1551 ms1.6%
store_daily_statsstats/models.py:18 f"{lang.code}_posts": Post.objects.filter(3 ms3.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:873 ms3.1%
QuerySet.filterdjango/db/models/query.py:16763 ms3.1%
QuerySet._filter_or_excludedjango/db/models/query.py:16943 ms3.1%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:17043 ms3.1%
Query.add_qdjango/db/models/sql/query.py:16813 ms3.1%
Query._add_qdjango/db/models/sql/query.py:17133 ms3.1%
Query.build_filterdjango/db/models/sql/query.py:15771 ms1.6%
Query.setup_joinsdjango/db/models/sql/query.py:19891 ms1.6%
Query.is_nullabledjango/db/models/sql/query.py:27891 ms1.6%
store_daily_statsstats/models.py:15 account_defaults["total_accounts"] = Account.objects.filter(accountlookup__isnull=False).count()1 ms1.6%
QuerySet.countdjango/db/models/query.py:6771 ms1.6%
Query.get_countdjango/db/models/sql/query.py:6571 ms1.6%
Query.get_aggregationdjango/db/models/sql/query.py:6391 ms1.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16251 ms1.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms1.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms1.6%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms1.6%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms1.6%
Cursor.executepsycopg/cursor.py:1131 ms1.6%
Connection.waitpsycopg/connection.py:4951 ms1.6%
store_daily_statsstats/models.py:25 Daily.objects.update_or_create(date=today, defaults=account_defaults | post_defaults)1 ms1.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms1.6%
QuerySet.update_or_createdjango/db/models/query.py:10961 ms1.6%
QuerySet.get_or_createdjango/db/models/query.py:10611 ms1.6%
QuerySet.createdjango/db/models/query.py:7361 ms1.6%
Model.savedjango/db/models/base.py:9041 ms1.6%
Model.save_basedjango/db/models/base.py:9961 ms1.6%
Model._save_tabledjango/db/models/base.py:11991 ms1.6%
Model._do_insertdjango/db/models/base.py:12511 ms1.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms1.6%
QuerySet._insertdjango/db/models/query.py:21411 ms1.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19361 ms1.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms1.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms1.6%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1021 ms1.6%
QueryStats.addflakytest/profiling/dbtrack.py:381 ms1.6%
normalize_sqlflakytest/profiling/dbtrack.py:251 ms1.6%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:32 account = Account.objects.create(3 ms3.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:873 ms3.1%
QuerySet.createdjango/db/models/query.py:7341 ms1.6%
Model.__init__django/db/models/base.py:5531 ms1.6%
QuerySet.createdjango/db/models/query.py:7361 ms1.6%
Model.savedjango/db/models/base.py:9041 ms1.6%
Model.save_basedjango/db/models/base.py:9961 ms1.6%
Model._save_tabledjango/db/models/base.py:11991 ms1.6%
Model._do_insertdjango/db/models/base.py:12511 ms1.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms1.6%
QuerySet._insertdjango/db/models/query.py:21411 ms1.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19361 ms1.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms1.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms1.6%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms1.6%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms1.6%
Cursor.executepsycopg/cursor.py:1131 ms1.6%
Connection.waitpsycopg/connection.py:4951 ms1.6%
BaseCursor._execute_genpsycopg/_cursor_base.py:2061 ms1.6%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2861 ms1.6%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:781 ms1.6%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:58 AccountLookup.objects.create(account=account, language="python\n")1 ms1.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms1.6%
QuerySet.createdjango/db/models/query.py:7361 ms1.6%
Model.savedjango/db/models/base.py:9041 ms1.6%
Model.save_basedjango/db/models/base.py:9961 ms1.6%
Model._save_tabledjango/db/models/base.py:11991 ms1.6%
Model._do_insertdjango/db/models/base.py:12511 ms1.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:871 ms1.6%
QuerySet._insertdjango/db/models/query.py:21411 ms1.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19361 ms1.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms1.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms1.6%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms1.6%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms1.6%
Cursor.executepsycopg/cursor.py:1131 ms1.6%
Connection.waitpsycopg/connection.py:4951 ms1.6%
BaseCursor._execute_genpsycopg/_cursor_base.py:2061 ms1.6%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2861 ms1.6%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:781 ms1.6%
SimpleTestCase._setup_and_calldjango/test/testcases.py:3721 ms1.6%
TransactionTestCase._post_teardowndjango/test/testcases.py:1243 self._fixture_teardown()1 ms1.6%
TestCase._fixture_teardowndjango/test/testcases.py:14981 ms1.6%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4951 ms1.6%
CursorWrapper.executedjango/db/backends/utils.py:791 ms1.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms1.6%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1001 ms1.6%
CursorWrapper._executedjango/db/backends/utils.py:1031 ms1.6%
Cursor.executepsycopg/cursor.py:1131 ms1.6%
Connection.waitpsycopg/connection.py:4951 ms1.6%
BaseCursor._execute_genpsycopg/_cursor_base.py:2061 ms1.6%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2861 ms1.6%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:781 ms1.6%
teardown3 ms4.0%
CallInfo.from_call_pytest/runner.py:3613 ms4.0%
call_and_report.<locals>.<lambda>_pytest/runner.py:2503 ms4.0%
HookCaller.__call__pluggy/_hooks.py:5123 ms4.0%
PluginManager._hookexecpluggy/_manager.py:1203 ms4.0%
_multicallpluggy/_callers.py:1213 ms4.0%
pytest_runtest_teardown_pytest/runner.py:1993 ms4.0%
SetupState.teardown_exact_pytest/runner.py:5683 ms4.0%
FixtureDef.finish_pytest/fixtures.py:11563 ms4.0%
_teardown_yield_fixture_pytest/fixtures.py:10143 ms4.0%
UnitTestCase._register_unittest_setup_class_fixture.<locals>.unittest_setup_class_fixture_pytest/unittest.py:1693 ms4.0%
TestCase.tearDownClassdjango/test/testcases.py:1458 conn.close()3 ms4.0%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:263 ms4.0%
BaseDatabaseWrapper.closedjango/db/backends/base/base.py:3553 ms4.0%
DatabaseWrapper._closedjango/db/backends/postgresql/base.py:4083 ms4.0%
Connection.closepsycopg/connection.py:2013 ms4.0%
Estimated from 65 samples; phase durations are exact. Frames from pytest and pluggy are shown .

Hot lines in your code

stats/models.py:20
).count()
store_daily_stats · Database
36 ms
stats/models.py:12
f"{lang.code}_accounts": AccountLookup.objects.filter(language__icontains=lang.code + "\n").count()
store_daily_stats · Database
32 ms
stats/tests.py:32
account = Account.objects.create(
TestStats.test_store_daily_stats_with_accounts · Database
3 ms
stats/models.py:18
f"{lang.code}_posts": Post.objects.filter(
store_daily_stats · Database
3 ms
stats/tests.py:58
AccountLookup.objects.create(account=account, language="python\n")
TestStats.test_store_daily_stats_with_accounts · Database
1 ms
stats/models.py:15
account_defaults["total_accounts"] = Account.objects.filter(accountlookup__isnull=False).count()
store_daily_stats · Database
1 ms
stats/models.py:25
Daily.objects.update_or_create(date=today, defaults=account_defaults | post_defaults)
store_daily_stats · Database
1 ms

Fixtures

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

Database

104 queries · 43 ms

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

44×
SELECT COUNT(*) AS "__count" FROM "accounts_accountlookup" WHERE UPPER("accounts_accountlookup"."language"::text) LIKE UPPER(%s)
44×
SELECT COUNT(*) AS "__count" FROM "posts_post" INNER JOIN "accounts_account" ON ("posts_post"."account_id" = "accounts_account"."id") INNER JOIN "accounts_accountlookup" ON ("accounts_account"."id" = "accounts_accountlookup"."account_id") WHERE UPPER("accounts_accountlookup"."language"::text) LIKE …

Biggest pieces of work

call test body
stats/tests.py:60
77 ms
teardown tearDownClass
django/test/testcases.py:1458
3 ms
call _post_teardown
django/test/testcases.py:1243
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 50 results, oldest first in the strip
When Environment Outcome Duration Commit
8 hours ago CI github-actions:test passed 83 ms d923a46 main Profile
8 hours ago CI github-actions:test passed 245 ms 82997f8 main Profile
8 hours ago CI github-actions:test passed 224 ms 623aa3e main Profile
13 hours ago CI github-actions:test passed 322 ms ab6465a main Profile
14 hours ago CI github-actions:test passed 113 ms 0c23747 main Run
3 months, 3 weeks ago CI github-actions passed 75 ms 69d78ea HEAD Run
3 months, 3 weeks ago CI github-actions passed 93 ms 8fac7b5 main Run
3 months, 3 weeks ago CI github-actions passed 86 ms 36b9579 main Run
3 months, 3 weeks ago CI github-actions passed 93 ms 553d048 main Run
3 months, 3 weeks ago CI github-actions passed 90 ms 8eb0f44 HEAD Run
3 months, 3 weeks ago CI github-actions passed 92 ms e0fb3ac HEAD Run
3 months, 3 weeks ago CI github-actions passed 85 ms a849b58 HEAD Run
3 months, 3 weeks ago CI github-actions passed 94 ms 6418e05 HEAD Run
3 months, 3 weeks ago CI github-actions passed 95 ms 5b9b309 main Run
3 months, 4 weeks ago CI github-actions passed 95 ms 1f2c5a6 main Run
3 months, 4 weeks ago CI github-actions passed 94 ms 5ec7fa8 main Run
3 months, 4 weeks ago CI github-actions passed 95 ms 1e42064 main Run
3 months, 4 weeks ago CI github-actions passed 87 ms fcb1b79 main Run
3 months, 4 weeks ago CI github-actions passed 103 ms 1460ac2 HEAD Run
3 months, 4 weeks ago CI github-actions passed 91 ms 8129f09 HEAD Run