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

TestToggleStarterPackAccount::test_toggle_after_limit

First seen 1 year, 10 months ago in fd2a55f
CI github-actions:test 4 runs
Average
1.39 s
median 1.53 s
max 1.79 s
Phases
Setup 3 ms Call 1.38 s Teardown 2 ms
Categories
Database 982 ms Factories 252 ms App code 0.97 ms Test code 0.38 ms Other (Libraries, pytest, Deep copies, Imports, ...) 151 ms

499 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
call696 ms99.8%
TestToggleStarterPackAccount.test_toggle_after_limitstarter_packs/tests.py:397 baker.make("starter_packs.StarterPackAccount", starter_pack=self.starter_pack, _quantity=150)604 ms86.5%
makemodel_bakery/baker.py:166604 ms86.5%
Baker.makemodel_bakery/baker.py:454602 ms86.3%
Baker._makemodel_bakery/baker.py:529499 ms71.6%
Baker.generate_valuemodel_bakery/baker.py:1019499 ms71.6%
gen_relatedmodel_bakery/random_gen.py:454495 ms70.9%
makemodel_bakery/baker.py:175490 ms70.3%
Baker.makemodel_bakery/baker.py:454490 ms70.3%
Baker._makemodel_bakery/baker.py:542359 ms51.5%
Baker.instancemodel_bakery/baker.py:659334 ms47.9%
Model.savedjango/db/models/base.py:904213 ms30.6%
Model.save_basedjango/db/models/base.py:996210 ms30.1%
Model._save_tabledjango/db/models/base.py:1199195 ms28.0%
Model._do_insertdjango/db/models/base.py:1251192 ms27.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:87192 ms27.6%
QuerySet._insertdjango/db/models/query.py:2141192 ms27.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:1936173 ms24.8%
CursorWrapper.executedjango/db/backends/utils.py:79173 ms24.8%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:92171 ms24.6%
CursorWrapper._executedjango/db/backends/utils.py:105161 ms23.1%
Cursor.executepsycopg/cursor.py:113161 ms23.1%
Connection.waitpsycopg/connection.py:495161 ms23.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:206119 ms17.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:286116 ms16.7%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:78116 ms16.7%
2 smaller frames hidden
BaseCursor._execute_genpsycopg/_cursor_base.py:20510 ms1.5%
BaseCursor._convert_querypsycopg/_cursor_base.py:46510 ms1.5%
PostgresClientQuery.convertpsycopg/_queries.py:2899 ms1.3%
PostgresClientQuery.dumppsycopg/_queries.py:2997 ms1.1%
PostgresClientQuery.dump.<locals>.<genexpr>psycopg/_queries.py:3007 ms1.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:193516 ms2.4%
SQLInsertCompiler.as_sqldjango/db/models/sql/compiler.py:18246 ms0.9%
6 smaller frames hidden
2 smaller frames hidden
Model._save_tabledjango/db/models/base.py:10974 ms0.6%
6 smaller frames hidden
1 smaller frames hidden
AbstractBaseUser.savedjango/contrib/auth/base_user.py:62115 ms16.5%
Model.savedjango/db/models/base.py:904115 ms16.5%
Model.save_basedjango/db/models/base.py:996112 ms16.0%
Model._save_tabledjango/db/models/base.py:1199103 ms14.7%
Model._do_insertdjango/db/models/base.py:1251103 ms14.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:87101 ms14.5%
QuerySet._insertdjango/db/models/query.py:2141100 ms14.3%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:193685 ms12.2%
CursorWrapper.executedjango/db/backends/utils.py:7985 ms12.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9283 ms12.0%
CursorWrapper._executedjango/db/backends/utils.py:10579 ms11.3%
Cursor.executepsycopg/cursor.py:11379 ms11.3%
Connection.waitpsycopg/connection.py:49579 ms11.3%
BaseCursor._execute_genpsycopg/_cursor_base.py:20664 ms9.2%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28663 ms9.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7863 ms9.0%
1 smaller frames hidden
1 smaller frames hidden
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19356 ms0.9%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19674 ms0.6%
1 smaller frames hidden
Model._save_tabledjango/db/models/base.py:11104 ms0.6%
2 smaller frames hidden
1 smaller frames hidden
2 smaller frames hidden
Baker.instancemodel_bakery/baker.py:63119 ms2.8%
2 smaller frames hidden
Baker._makemodel_bakery/baker.py:52992 ms13.2%
Baker.generate_valuemodel_bakery/baker.py:101976 ms10.9%
gen_stringmodel_bakery/random_gen.py:27063 ms9.0%
gen_string.<locals>.<genexpr>model_bakery/random_gen.py:27051 ms7.3%
Random.choice<stdlib>/random.py:35431 ms4.5%
Random._randbelow_with_getrandbits<stdlib>/random.py:24912 ms1.7%
3 smaller frames hidden
1 smaller frames hidden
1 smaller frames hidden
5 smaller frames hidden
Baker._makemodel_bakery/baker.py:50136 ms5.1%
Baker._skip_fieldmodel_bakery/baker.py:7529 ms1.3%
Baker.instancemodel_bakery/baker.py:6596 ms0.9%
Model.savedjango/db/models/base.py:9044 ms0.6%
Model.save_basedjango/db/models/base.py:9964 ms0.6%
Model._save_tabledjango/db/models/base.py:11994 ms0.6%
Model._do_insertdjango/db/models/base.py:12514 ms0.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:874 ms0.6%
QuerySet._insertdjango/db/models/query.py:21414 ms0.6%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19364 ms0.6%
CursorWrapper.executedjango/db/backends/utils.py:794 ms0.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:924 ms0.6%
1 smaller frames hidden
10 smaller frames hidden
1 smaller frames hidden
1 smaller frames hidden
1 smaller frames hidden
Baker._makemodel_bakery/baker.py:54292 ms13.2%
Baker.instancemodel_bakery/baker.py:65983 ms12.0%
Model.savedjango/db/models/base.py:90482 ms11.8%
Model.save_basedjango/db/models/base.py:99682 ms11.8%
Model._save_tabledjango/db/models/base.py:119982 ms11.8%
Model._do_insertdjango/db/models/base.py:125182 ms11.8%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:8782 ms11.8%
QuerySet._insertdjango/db/models/query.py:214180 ms11.5%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:193673 ms10.5%
CursorWrapper.executedjango/db/backends/utils.py:7973 ms10.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9273 ms10.5%
CursorWrapper._executedjango/db/backends/utils.py:10567 ms9.6%
Cursor.executepsycopg/cursor.py:11367 ms9.6%
Connection.waitpsycopg/connection.py:49567 ms9.6%
BaseCursor._execute_genpsycopg/_cursor_base.py:20643 ms6.2%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28642 ms6.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7842 ms6.0%
1 smaller frames hidden
1 smaller frames hidden
2 smaller frames hidden
1 smaller frames hidden
Baker.instancemodel_bakery/baker.py:6319 ms1.3%
Model.__init__django/db/models/base.py:5864 ms0.6%
3 smaller frames hidden
Baker._makemodel_bakery/baker.py:50110 ms1.5%
TestToggleStarterPackAccount.test_toggle_after_limitstarter_packs/tests.py:400 response = self.client.post(34 ms4.9%
Client.postdjango/test/client.py:116234 ms4.9%
RequestFactory.postdjango/test/client.py:49934 ms4.9%
RequestFactory.genericdjango/test/client.py:67134 ms4.9%
Client.requestdjango/test/client.py:109134 ms4.9%
ClientHandler.__call__django/test/client.py:17327 ms3.8%
BaseHandler.load_middlewaredjango/core/handlers/base.py:6327 ms3.8%
WhiteNoiseMiddleware.__init__whitenoise/middleware.py:10425 ms3.6%
WhiteNoise.add_fileswhitenoise/base.py:10825 ms3.6%
WhiteNoise.update_files_dictionarywhitenoise/base.py:12016 ms2.4%
WhiteNoise.add_file_to_dictionarywhitenoise/base.py:13116 ms2.4%
WhiteNoise.get_static_filewhitenoise/base.py:21715 ms2.1%
StaticFile.__init__whitenoise/responders.py:726 ms0.9%
StaticFile.get_file_statswhitenoise/responders.py:1616 ms0.9%
__init____init__:-16 ms0.9%
FileEntry.__init__whitenoise/responders.py:2636 ms0.9%
FileEntry.stat_regular_filewhitenoise/responders.py:2766 ms0.9%
<GC>~6 ms0.9%
StaticFile.__init__whitenoise/responders.py:764 ms0.6%
2 smaller frames hidden
1 smaller frames hidden
WhiteNoise.update_files_dictionarywhitenoise/base.py:1159 ms1.3%
scantreewhitenoise/base.py:2717 ms1.1%
scantreewhitenoise/base.py:2716 ms0.9%
1 smaller frames hidden
1 smaller frames hidden
1 smaller frames hidden
ClientHandler.__call__django/test/client.py:1867 ms1.1%
BaseHandler.get_responsedjango/core/handlers/base.py:1427 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
WhiteNoiseMiddleware.__call__whitenoise/middleware.py:1237 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
DebugToolbarMiddleware.__call__debug_toolbar/middleware.py:1457 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
MiddlewareMixin.__call__django/utils/deprecation.py:3807 ms1.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:567 ms1.1%
BaseHandler._get_responsedjango/core/handlers/base.py:1997 ms1.1%
user_passes_test.<locals>.decorator.<locals>._view_wrapperdjango/contrib/auth/decorators.py:627 ms1.1%
TransactionTestCase._post_teardowndjango/test/testcases.py:1243 self._fixture_teardown()25 ms3.6%
TestCase._fixture_teardowndjango/test/testcases.py:149824 ms3.4%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:49524 ms3.4%
CursorWrapper.executedjango/db/backends/utils.py:7924 ms3.4%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9224 ms3.4%
CursorWrapper._executedjango/db/backends/utils.py:10324 ms3.4%
Cursor.executepsycopg/cursor.py:11324 ms3.4%
Connection.waitpsycopg/connection.py:49524 ms3.4%
1 smaller frames hidden
TestToggleStarterPackAccount.test_toggle_after_limitstarter_packs/tests.py:41115 ms2.1%
Client.postdjango/test/client.py:116215 ms2.1%
RequestFactory.postdjango/test/client.py:49915 ms2.1%
RequestFactory.genericdjango/test/client.py:67115 ms2.1%
Client.requestdjango/test/client.py:109115 ms2.1%
ClientHandler.__call__django/test/client.py:18615 ms2.1%
BaseHandler.get_responsedjango/core/handlers/base.py:14215 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
WhiteNoiseMiddleware.__call__whitenoise/middleware.py:12315 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
DebugToolbarMiddleware.__call__debug_toolbar/middleware.py:14515 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
MiddlewareMixin.__call__django/utils/deprecation.py:38015 ms2.1%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5615 ms2.1%
BaseHandler._get_responsedjango/core/handlers/base.py:19915 ms2.1%
user_passes_test.<locals>.decorator.<locals>._view_wrapperdjango/contrib/auth/decorators.py:6215 ms2.1%
toggle_account_to_starter_packstarter_packs/views.py:6604 ms0.6%
get_splash_image_signaturestarter_packs/splash_images.py:884 ms0.6%
get_splash_image_accountsstarter_packs/splash_images.py:77 return list(accounts)4 ms0.6%
QuerySet.__iter__django/db/models/query.py:4394 ms0.6%
QuerySet._fetch_alldjango/db/models/query.py:22624 ms0.6%
4 smaller frames hidden
TestToggleStarterPackAccount.test_toggle_after_limitstarter_packs/tests.py:395 self.client.force_login(self.user)7 ms1.1%
ClientMixin.force_logindjango/test/client.py:8587 ms1.1%
ClientMixin._logindjango/test/client.py:8894 ms0.6%
2 smaller frames hidden
TestToggleStarterPackAccount.test_toggle_after_limitstarter_packs/tests.py:399 self.assertEqual(self.starter_pack.starterpackaccount_set.count(), 150)4 ms0.6%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:874 ms0.6%
QuerySet.countdjango/db/models/query.py:6774 ms0.6%
4 smaller frames hidden
Estimated from 467 samples; phase durations are exact. Frames from pytest and pluggy are hidden .

Hot lines in your code

starter_packs/tests.py:397
baker.make("starter_packs.StarterPackAccount", starter_pack=self.starter_pack, _quantity=150)
TestToggleStarterPackAccount.test_toggle_after_limit · Database
604 ms
starter_packs/tests.py:400
response = self.client.post(
TestToggleStarterPackAccount.test_toggle_after_limit · Libraries
27 ms
starter_packs/tests.py:395
self.client.force_login(self.user)
TestToggleStarterPackAccount.test_toggle_after_limit · Database
7 ms
starter_packs/views.py:619
starter_pack = get_object_or_404(StarterPack.objects.select_for_update(), pk=editable.pk)
toggle_account_to_starter_pack · Database
6 ms
starter_packs/splash_images.py:77
return list(accounts)
get_splash_image_accounts · Database
4 ms
starter_packs/tests.py:399
self.assertEqual(self.starter_pack.starterpackaccount_set.count(), 150)
TestToggleStarterPackAccount.test_toggle_after_limit · Database
4 ms
starter_packs/views.py:620
account = get_object_or_404(Account, id=account_id)
toggle_account_to_starter_pack · Database
4 ms
starter_packs/views.py:657
).count()
toggle_account_to_starter_pack · Database
3 ms
starter_packs/tests.py:394
account = baker.make("accounts.Account", discoverable=True)
TestToggleStarterPackAccount.test_toggle_after_limit · Database
1 ms
starter_packs/views.py:621
if StarterPackAccount.objects.filter(starter_pack=starter_pack, account_id=account_id).exists():
toggle_account_to_starter_pack · Database
1 ms

Fixtures

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

Database

499 queries · 276 ms

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

151×
INSERT INTO "accounts_account" ("account_id", "instance", "instance_model_id", "username_at_instance", "search", "username", "acct", "display_name", "locked", "bot", "discoverable", "group", "noindex", "created_at", "last_status_at", "last_sync_at", "followers_count", "following_count", "statuses_c…
151×
INSERT INTO "auth_user" ("password", "last_login", "is_superuser", "username", "first_name", "last_name", "email", "is_staff", "is_active", "date_joined") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING "auth_user"."id"
151×
INSERT INTO "starter_packs_starterpackaccount" ("starter_pack_id", "account_id", "pinned", "created_at", "created_by_id") VALUES (%s, %s, %s, %s, %s) RETURNING "starter_packs_starterpackaccount"."id"
6×
SELECT COUNT(*) AS "__count" FROM "starter_packs_starterpackaccount" WHERE "starter_packs_starterpackaccount"."starter_pack_id" = %s
4×
SELECT "starter_packs_starterpack"."id", "starter_packs_starterpack"."title", "starter_packs_starterpack"."slug", "starter_packs_starterpack"."description", "starter_packs_starterpack"."languages", "starter_packs_starterpack"."created_by_id", "starter_packs_starterpack"."created_at", "starter_packs…

Biggest pieces of work

call test body
starter_packs/tests.py:397
669 ms
call _post_teardown
django/test/testcases.py:1243
25 ms
call _pre_setup
django/test/testcases.py:1167
1 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
7 hours ago CI github-actions:test passed 698 ms d923a46 main Profile
7 hours ago CI github-actions:test passed 1.39 s 82997f8 main Profile
7 hours ago CI github-actions:test passed 1.67 s 623aa3e main Profile
12 hours ago CI github-actions:test passed 1.79 s ab6465a main Profile
12 hours ago CI github-actions:test passed 762 ms 0c23747 main Run
3 months, 3 weeks ago CI github-actions passed 652 ms 69d78ea HEAD Run
3 months, 3 weeks ago CI github-actions passed 919 ms 8fac7b5 main Run
3 months, 3 weeks ago CI github-actions passed 1.24 s 36b9579 main Run
3 months, 3 weeks ago CI github-actions passed 952 ms 553d048 main Run
3 months, 3 weeks ago CI github-actions passed 908 ms 8eb0f44 HEAD Run
3 months, 3 weeks ago CI github-actions passed 943 ms e0fb3ac HEAD Run
3 months, 3 weeks ago CI github-actions passed 952 ms a849b58 HEAD Run
3 months, 3 weeks ago CI github-actions passed 940 ms 6418e05 HEAD Run
3 months, 3 weeks ago CI github-actions passed 1.09 s 5b9b309 main Run
3 months, 4 weeks ago CI github-actions passed 1.04 s 1f2c5a6 main Run
3 months, 4 weeks ago CI github-actions passed 946 ms 5ec7fa8 main Run
3 months, 4 weeks ago CI github-actions passed 941 ms 1e42064 main Run
3 months, 4 weeks ago CI github-actions passed 968 ms fcb1b79 main Run
3 months, 4 weeks ago CI github-actions passed 969 ms 1460ac2 HEAD Run
3 months, 4 weeks ago CI github-actions passed 924 ms 8129f09 HEAD Run