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

TestStats::test_store_daily_stats_with_accounts

First seen 2 years, 11 months ago in 1cd3a8d
CI github-actions:test 11 runs
Average
161 ms
median 137 ms
max 322 ms
Phases
Setup 4 ms Call 154 ms Teardown 3 ms
Categories
Database 156 ms App code 1 ms Other (pytest, Unsampled, Libraries) 4 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, 7 hours ago · open run
Show pytest frames
call133 ms97.0%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:60 store_daily_stats()130 ms94.7%
store_daily_statsstats/models.py:20 ).count()79 ms57.3%
QuerySet.countdjango/db/models/query.py:67779 ms57.3%
Query.get_countdjango/db/models/sql/query.py:65779 ms57.3%
Query.get_aggregationdjango/db/models/sql/query.py:63975 ms54.9%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:162567 ms49.1%
CursorWrapper.executedjango/db/backends/utils.py:7967 ms49.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9267 ms49.1%
CursorWrapper._executedjango/db/backends/utils.py:10567 ms49.1%
Cursor.executepsycopg/cursor.py:11367 ms49.1%
Connection.waitpsycopg/connection.py:49567 ms49.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:20645 ms32.7%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28645 ms32.7%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7843 ms31.6%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16126 ms4.7%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7933 ms2.3%
SQLCompiler.get_from_clausedjango/db/models/sql/compiler.py:11603 ms2.3%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5793 ms2.3%
Join.as_sqldjango/db/models/sql/datastructures.py:883 ms2.3%
DatabaseOperations.prepare_join_on_clausedjango/db/backends/postgresql/operations.py:4023 ms2.3%
ForeignKey.db_typedjango/db/models/fields/related.py:13093 ms2.3%
BigAutoField.rel_db_typedjango/db/models/fields/__init__.py:29772 ms1.2%
Field.__init__django/db/models/fields/__init__.py:2622 ms1.2%
Field.choicesdjango/db/models/fields/__init__.py:5902 ms1.2%
normalize_choicesdjango/utils/choices.py:752 ms1.2%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7682 ms1.2%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7962 ms1.2%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5792 ms1.2%
WhereNode.as_sqldjango/db/models/sql/where.py:1512 ms1.2%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5792 ms1.2%
BuiltinLookup.as_sqldjango/db/models/lookups.py:2432 ms1.2%
BuiltinLookup.process_lhsdjango/db/models/lookups.py:2352 ms1.2%
Lookup.process_lhsdjango/db/models/lookups.py:1092 ms1.2%
BaseExpression.resolve_expressiondjango/db/models/expressions.py:2972 ms1.2%
BaseExpression.copydjango/db/models/expressions.py:4442 ms1.2%
copy<stdlib>/copy.py:1002 ms1.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16502 ms1.2%
Query.get_aggregationdjango/db/models/sql/query.py:6463 ms2.3%
SQLCompiler.has_composite_fieldsdjango/db/models/sql/compiler.py:15503 ms2.3%
SQLCompiler.has_composite_fields.<locals>.<genexpr>django/db/models/sql/compiler.py:15503 ms2.3%
store_daily_statsstats/models.py:12 f"{lang.code}_accounts": AccountLookup.objects.filter(language__icontains=lang.code + "\n").count()39 ms28.1%
QuerySet.countdjango/db/models/query.py:67735 ms25.7%
Query.get_countdjango/db/models/sql/query.py:65735 ms25.7%
Query.get_aggregationdjango/db/models/sql/query.py:63934 ms24.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:162524 ms17.5%
CursorWrapper.executedjango/db/backends/utils.py:7924 ms17.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9224 ms17.5%
CursorWrapper._executedjango/db/backends/utils.py:10524 ms17.5%
Cursor.executepsycopg/cursor.py:11324 ms17.5%
Connection.waitpsycopg/connection.py:49524 ms17.5%
BaseCursor._execute_genpsycopg/_cursor_base.py:20622 ms16.4%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28622 ms16.4%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7822 ms16.4%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16126 ms4.7%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7686 ms4.7%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:896 ms4.7%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:786 ms4.7%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3195 ms3.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16233 ms2.3%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:263 ms2.3%
BaseDatabaseWrapper.cursordjango/db/backends/base/base.py:3202 ms1.2%
BaseDatabaseWrapper._cursordjango/db/backends/base/base.py:2982 ms1.2%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms1.2%
DatabaseWrapper.create_cursordjango/db/backends/postgresql/base.py:4422 ms1.2%
Connection.cursorpsycopg/connection.py:2592 ms1.2%
䡽綋䣐疍M蕈瓀䡷쎉譈�赈嗨䷫䠀삅杴譈⭈᡼赈謼襈䧆욉ퟨ§褀䳁즅䩴උঐ빁ꗨő女￿뿿䑶譈ꬽဎ䠀욉ᗿໂ譈鬽ဎ䠀�ᗿາ襌䣰쒃嬠幁썝ㅅ䗯�උ०빁ꘈő듫쇿襁첵쳌쳌쳌쳌쳌쳌쳌䡕偓襈ㇷ䣛喍뻰)쀱㯨䗰蔀瓀䠼綋ㇰ㇛M蕈瓀茪⼸ࢹ冦묁ꗨő཈�譈༽ဎ䠀욉ᗿฦ΋]￿皿䠊�荈ࣄ嵛ᅢ觀쳰쳌쳌䡕噁䡓 �襈ㇷ䣛喍뻨)쀱쏨䗯蔀瓀䡎綋䣨疍M蕈瓀䤺욉赈債￿䣿잉�䷵묀ꗨő삅ぴ譈贽ဍ䰀ᗿඤ΋]￿瞿(觀㄂䣛�腈ꃄ�嬀幁썝薋ィ￿솉�女耀�멵䦨冥묁ꘈő཈�꣫쳌쳌䡕坁噁啁呁䡓˜�襉擶譈┄(�襈큅좉褆菋샡襁䇟䰿ⲍ䠑붉h￿襈觖薖hʼn䇞㞼�묀7�⥄菳㿣圏䣀붍p￿⤏灇⤏恇⤏假⤏䁇⤏ぇ⤏⁇⤏၇⤏뤇€�襌䳮憎맨§䴀ⲍ䤯얁q￿왁e薀瓛䔔荁㿤襌㇯䳶燨µ䄀ᒍ茟ূ셉Ϧ襍ᵴ섀۪赈債￿䣿붋h￿ﯨ梄搀譈┄(�㭈큅ት腈飄�嬀屁嵁幁彁썝ᗨÂ찀쳌쳌䡕坁噁啁呁䡓䄘횉襈࿻Ԩ庒ﻬ赌쁽ཁܩ䐆茿Ǹ�䄀풉셁ۤ⥅仦ⲍ䰦ノ藨梄䰀ノ襌䳦襄ﺔ￿ཁܨᄏ䠃쒃嬘屁嵁幁彁썝쳌쳌쳌쳌쳌쳌쳌䡕ދ젏ډ䞋༄览ц䞋༈览ࡆ䞋༌览ె䞋༐览၆썝쳌쳌䡕坁噁啁呁䡓˜�襉擶譈┄(�襈큅좉褆菋샡襁䇟䰿ⲍ䠑붉h￿襈觖㶖gʼn䇞㞼�묀7�⥄菳㿣圏䣀붍p￿⤏灇⤏恇⤏假⤏䁇⤏ぇ⤏⁇⤏၇⤏뤇€�襌䳮憎裡¥䴀ⲍ䤯얁q￿왁e薀瓛䔔荁㿤襌㇯䳶뇨³䤀䤃츏赁ἔ슃䴉璉䠆떍p￿譈䢽￿㳸g䡤ҋ⠥�䠀䔻痐䠒쒁˜�䅛䅜䅝䅞嵟쁒�쳌䡕坁噁啁呁䡓䄘힉襈࿻ԨᙒH赌쁵ཁة읁၆쏒䐆茿Ǹ�䄀풉셁ۤ⥅仧ⲍ䰦編朼䰀襌䳦襄ﺌ￿譁༆览䄃䚋༄览у譁ࡆ젏䎉䄈䚋༌览ృ譁၆젏䎉䠐쒃嬘屁嵁幁彁썝쳌䡕坁噁啁呁䡓˜�襈䢍￿䧿ﺉ䡤ҋ⠥�䠀䖉䓐溍㇈䇛ﶃ྿쎒圏䳀붍p￿ཁ䜩䅰⤏恇ཁ䜩䅐⤏䁇ཁ䜩䄰⤏⁇ཁ䜩䄐⤏䤇䤃츏襁맴€�襌䣿횉襌ꑚ�왂▄p￿솀ۣ襌ᵴ䢈鶋h￿襌䣿�矨栏䇿ﶃ瞾䠌綍䢐�旨栏擿譈┄(�㭈큅ት腈飄�嬀屁嵁幁彁썝쿨¾찀쳌쳌쳌쳌쳌쳌쳌䡕ދ例༄࿈诉ࡗ쨏譄ేཁ䓈例䄐줏譄ᑗཁ䓊律䄘쬏羋༜觏褆ю嚉䐈䚉䐌争䐐嚉䐔庉褘᱾썝䡕ދ例༄࿈诉ࡗ쨏譄ేཁ䓈例䄐줏譄ᑗཁ诊᡿켏ډ争褄ࡖ襄ె襄၎襄ᑖ纉崘쳃쳌쳌쳌쳌쳌䡕坁噁啁呁䡓Ę�襌삅￾䣿趉ﻈ￿펉襉䧶ノ䡤ҋ⠥�䠀䖉䓐掍䖐腁翼￿䇿鈏䣅붍ﻐ￿º㄀냔�ཌྷﺤ䤃䤃츏ཉ觏맛Ā�赈킽￾䣿떋ﻈ￿襈ꋈ�蓆퀝￾胿譈삝￾䇿万뒉䀭￿仿벉䠭￿䣿붍ﻐ￿襈븦ト腁综￿矿䠏붍p￿襈븎ト䡤ҋ⠥�䠀䔻痐䠒쒁Ę�䅛䅜䅝䅞嵟봨�쳌쳌쳌쳌䡕譈䠇例䠈젏཈䣉型䠐쨏譌ᡇཉ䳈例䤠줏譌<unknown file>2 ms1.2%
deconstructible.<locals>.decorator.<locals>.__new__django/utils/deconstruct.py:172 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:-12 ms1.2%
store_daily_statsstats/models.py:15 account_defaults["total_accounts"] = Account.objects.filter(accountlookup__isnull=False).count()6 ms4.7%
QuerySet.countdjango/db/models/query.py:6776 ms4.7%
Query.get_countdjango/db/models/sql/query.py:6576 ms4.7%
Query.get_aggregationdjango/db/models/sql/query.py:6395 ms3.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16123 ms2.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7933 ms2.3%
SQLCompiler.get_from_clausedjango/db/models/sql/compiler.py:11603 ms2.3%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5792 ms1.2%
Join.as_sqldjango/db/models/sql/datastructures.py:882 ms1.2%
DatabaseOperations.prepare_join_on_clausedjango/db/backends/postgresql/operations.py:4022 ms1.2%
ForeignKey.db_typedjango/db/models/fields/related.py:13092 ms1.2%
BigAutoField.rel_db_typedjango/db/models/fields/__init__.py:29772 ms1.2%
Field.db_typedjango/db/models/fields/__init__.py:9182 ms1.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16252 ms1.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms1.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms1.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms1.2%
Cursor.executepsycopg/cursor.py:1132 ms1.2%
Connection.waitpsycopg/connection.py:4952 ms1.2%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms1.2%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2862 ms1.2%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms1.2%
Query.get_aggregationdjango/db/models/sql/query.py:4712 ms1.2%
store_daily_statsstats/models.py:18 f"{lang.code}_posts": Post.objects.filter(6 ms4.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:876 ms4.7%
QuerySet.filterdjango/db/models/query.py:16766 ms4.7%
QuerySet._filter_or_excludedjango/db/models/query.py:16946 ms4.7%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:17046 ms4.7%
Query.add_qdjango/db/models/sql/query.py:16816 ms4.7%
Query._add_qdjango/db/models/sql/query.py:17136 ms4.7%
Query.build_filterdjango/db/models/sql/query.py:15773 ms2.3%
Query.setup_joinsdjango/db/models/sql/query.py:19892 ms1.2%
Query.setup_joinsdjango/db/models/sql/query.py:20022 ms1.2%
Query.joindjango/db/models/sql/query.py:11502 ms1.2%
Query.build_filterdjango/db/models/sql/query.py:15732 ms1.2%
Query.build_filterdjango/db/models/sql/query.py:15512 ms1.2%
Query.solve_lookup_typedjango/db/models/sql/query.py:13582 ms1.2%
Query.names_to_pathdjango/db/models/sql/query.py:18012 ms1.2%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:32 account = Account.objects.create(2 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet.createdjango/db/models/query.py:7362 ms1.2%
Model.savedjango/db/models/base.py:9042 ms1.2%
Model.save_basedjango/db/models/base.py:9962 ms1.2%
Model._save_tabledjango/db/models/base.py:11992 ms1.2%
Model._do_insertdjango/db/models/base.py:12512 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet._insertdjango/db/models/query.py:21412 ms1.2%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19362 ms1.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms1.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms1.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms1.2%
Cursor.executepsycopg/cursor.py:1132 ms1.2%
Connection.waitpsycopg/connection.py:4952 ms1.2%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms1.2%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2862 ms1.2%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms1.2%
TestStats.test_store_daily_stats_with_accountsstats/tests.py:58 AccountLookup.objects.create(account=account, language="python\n")2 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet.createdjango/db/models/query.py:7362 ms1.2%
Model.savedjango/db/models/base.py:9042 ms1.2%
Model.save_basedjango/db/models/base.py:9962 ms1.2%
Model._save_tabledjango/db/models/base.py:11992 ms1.2%
Model._do_insertdjango/db/models/base.py:12512 ms1.2%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms1.2%
QuerySet._insertdjango/db/models/query.py:21412 ms1.2%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19362 ms1.2%
CursorWrapper.executedjango/db/backends/utils.py:792 ms1.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms1.2%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms1.2%
Cursor.executepsycopg/cursor.py:1132 ms1.2%
Connection.waitpsycopg/connection.py:4952 ms1.2%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms1.2%
Estimated from 83 samples; phase durations are exact. Frames from pytest and pluggy are hidden .

Hot lines in your code

stats/models.py:20
).count()
store_daily_stats · Database
79 ms
stats/models.py:12
f"{lang.code}_accounts": AccountLookup.objects.filter(language__icontains=lang.code + "\n").count()
store_daily_stats · Database
39 ms
stats/models.py:15
account_defaults["total_accounts"] = Account.objects.filter(accountlookup__isnull=False).count()
store_daily_stats · Database
6 ms
stats/models.py:18
f"{lang.code}_posts": Post.objects.filter(
store_daily_stats · Database
6 ms
stats/tests.py:32
account = Account.objects.create(
TestStats.test_store_daily_stats_with_accounts · Database
2 ms
stats/tests.py:58
AccountLookup.objects.create(account=account, language="python\n")
TestStats.test_store_daily_stats_with_accounts · Database
2 ms

Fixtures

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

Database

104 queries · 77 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
133 ms

Reliability

12 results · 0 CI failures · 0 local failures

This test hasn't failed recently.

History

Latest 12 results, oldest first in the strip
When Environment Outcome Duration Commit
7 hours ago CI github-actions:test passed 137 ms c28a326 main Profile
16 hours ago CI github-actions:test passed 79 ms 9b8826a main Profile
22 hours ago CI github-actions:test passed 173 ms 4f01055 main Profile
1 week, 5 days ago CI github-actions:test passed 140 ms 8ab642e main Profile
2 weeks, 2 days ago CI github-actions:test passed 121 ms 9b75244 main Profile
2 weeks, 2 days ago CI github-actions:test passed 112 ms 9603516 main Profile
2 weeks, 4 days ago CI github-actions:test passed 128 ms 615a272 main Profile
3 weeks ago CI github-actions:test passed 83 ms d923a46 main Profile
3 weeks ago CI github-actions:test passed 245 ms 82997f8 main Profile
3 weeks ago CI github-actions:test passed 224 ms 623aa3e main Profile
3 weeks ago CI github-actions:test passed 322 ms ab6465a main Profile
3 weeks ago CI github-actions:test passed 113 ms 0c23747 main Run