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

TestPostAnnouncements::test_posts_only_due_announcements

First seen 3 weeks ago in 0c23747
CI github-actions:test 11 runs
Average
19 ms
median 21 ms
max 32 ms
Phases
Setup 2 ms Call 17 ms Teardown 0.29 ms
Categories
Database 13 ms Factories 0.21 ms Other (Libraries, pytest, Mocking, Unsampled) 6 ms

11 database queries per run

Needs 33 KB of memory (max 52 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, 7 hours ago · open run
Show pytest frames
setup1 ms8.4%
call13 ms89.7%
TransactionTestCase._pre_setupdjango/test/testcases.py:1154 super()._pre_setup()11 ms71.8%
TestCase._fixture_setupdjango/test/testcases.py:148110 ms68.8%
TestCase._enter_atomicsdjango/test/testcases.py:139910 ms68.8%
Atomic.__enter__django/db/transaction.py:22310 ms68.8%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:2610 ms68.8%
BaseDatabaseWrapper.savepointdjango/db/backends/base/base.py:40010 ms68.8%
BaseDatabaseWrapper._savepointdjango/db/backends/base/base.py:36710 ms68.8%
CursorWrapper.executedjango/db/backends/utils.py:7910 ms68.8%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:9210 ms68.8%
CursorWrapper._executedjango/db/backends/utils.py:10310 ms68.8%
Cursor.executepsycopg/cursor.py:11310 ms68.8%
Connection.waitpsycopg/connection.py:49510 ms68.8%
BaseCursor._execute_genpsycopg/_cursor_base.py:20610 ms68.8%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:28610 ms68.8%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:7810 ms68.8%
SimpleTestCase._pre_setupdjango/test/testcases.py:3870.45 ms3.0%
TestPostAnnouncements.test_posts_only_due_announcementsannouncements/tests.py:53 status_post = self._run_at(dt.datetime(2026, 6, 1, 9, 0, tzinfo=dt.UTC))1 ms9.0%
TestPostAnnouncements._run_atannouncements/tests.py:42 call_command("postannouncements", *([] if dry_run else ["--no-dry-run"]))1 ms9.0%
call_commanddjango/core/management/__init__.py:1951 ms9.0%
RichCommand.executedjango_rich/management/__init__.py:341 ms9.0%
BaseCommand.executedjango/core/management/base.py:4661 ms9.0%
Command.handleannouncements/management/commands/postannouncements.py:26 due = list(Announcement.objects.filter(posted_at__isnull=True, post_at__lte=timezone.now()))0.45 ms3.0%
QuerySet.__iter__django/db/models/query.py:4390.45 ms3.0%
QuerySet._fetch_alldjango/db/models/query.py:22620.45 ms3.0%
ModelIterable.__iter__django/db/models/query.py:1030.45 ms3.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16250.45 ms3.0%
CursorWrapper.executedjango/db/backends/utils.py:790.45 ms3.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.45 ms3.0%
CursorWrapper._executedjango/db/backends/utils.py:1050.45 ms3.0%
Cursor.executepsycopg/cursor.py:1130.45 ms3.0%
Connection.waitpsycopg/connection.py:4950.45 ms3.0%
BaseCursor._execute_genpsycopg/_cursor_base.py:2060.45 ms3.0%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2860.45 ms3.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:780.45 ms3.0%
Command.handleannouncements/management/commands/postannouncements.py:47 mastodon = Mastodon(0.45 ms3.0%
CallableMixin.__call__<stdlib>/unittest/mock.py:11750.45 ms3.0%
Command.handleannouncements/management/commands/postannouncements.py:64 announcement.save(update_fields=["posted_at", "post_url", "error"])0.45 ms3.0%
Model.savedjango/db/models/base.py:9040.45 ms3.0%
Model.save_basedjango/db/models/base.py:9960.45 ms3.0%
Model._save_tabledjango/db/models/base.py:11400.45 ms3.0%
Model._do_updatedjango/db/models/base.py:12440.45 ms3.0%
QuerySet._updatedjango/db/models/query.py:14480.45 ms3.0%
SQLUpdateCompiler.execute_returning_sqldjango/db/models/sql/compiler.py:21500.45 ms3.0%
SQLUpdateCompiler.execute_sqldjango/db/models/sql/compiler.py:21210.45 ms3.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16250.45 ms3.0%
CursorWrapper.executedjango/db/backends/utils.py:790.45 ms3.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.45 ms3.0%
CursorWrapper._executedjango/db/backends/utils.py:1050.45 ms3.0%
Cursor.executepsycopg/cursor.py:1130.45 ms3.0%
Connection.waitpsycopg/connection.py:4950.45 ms3.0%
BaseCursor._execute_genpsycopg/_cursor_base.py:2060.45 ms3.0%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2860.45 ms3.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:780.45 ms3.0%
TestPostAnnouncements.setUpannouncements/tests.py:18 self.due = baker.make(0.45 ms3.0%
makemodel_bakery/baker.py:1750.45 ms3.0%
Baker.makemodel_bakery/baker.py:4540.45 ms3.0%
Baker._makemodel_bakery/baker.py:5420.45 ms3.0%
Baker.instancemodel_bakery/baker.py:6590.45 ms3.0%
Model.savedjango/db/models/base.py:9040.45 ms3.0%
Model.save_basedjango/db/models/base.py:9960.45 ms3.0%
Model._save_tabledjango/db/models/base.py:11990.45 ms3.0%
Model._do_insertdjango/db/models/base.py:12510.45 ms3.0%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:870.45 ms3.0%
QuerySet._insertdjango/db/models/query.py:21410.45 ms3.0%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19360.45 ms3.0%
CursorWrapper.executedjango/db/backends/utils.py:790.45 ms3.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.45 ms3.0%
CursorWrapper._executedjango/db/backends/utils.py:1050.45 ms3.0%
Cursor.executepsycopg/cursor.py:1130.45 ms3.0%
Connection.waitpsycopg/connection.py:4950.45 ms3.0%
TestPostAnnouncements.setUpannouncements/tests.py:25 self.not_due = baker.make(0.45 ms3.0%
makemodel_bakery/baker.py:1750.45 ms3.0%
Baker.makemodel_bakery/baker.py:4540.45 ms3.0%
Baker._makemodel_bakery/baker.py:5420.45 ms3.0%
Baker.instancemodel_bakery/baker.py:6590.45 ms3.0%
Model.savedjango/db/models/base.py:9040.45 ms3.0%
Model.save_basedjango/db/models/base.py:9960.45 ms3.0%
Model._save_tabledjango/db/models/base.py:11990.45 ms3.0%
Model._do_insertdjango/db/models/base.py:12510.45 ms3.0%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:870.45 ms3.0%
QuerySet._insertdjango/db/models/query.py:21410.45 ms3.0%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19360.45 ms3.0%
CursorWrapper.executedjango/db/backends/utils.py:790.45 ms3.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.45 ms3.0%
CursorWrapper._executedjango/db/backends/utils.py:1050.45 ms3.0%
Cursor.executepsycopg/cursor.py:1130.45 ms3.0%
Connection.waitpsycopg/connection.py:4950.45 ms3.0%
BaseCursor._execute_genpsycopg/_cursor_base.py:2060.45 ms3.0%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2860.45 ms3.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:780.45 ms3.0%
TestPostAnnouncements.test_posts_only_due_announcementsannouncements/tests.py:57 self.due.refresh_from_db()0.45 ms3.0%
Model.refresh_from_dbdjango/db/models/base.py:7880.45 ms3.0%
QuerySet.getdjango/db/models/query.py:7020.45 ms3.0%
QuerySet.__len__django/db/models/query.py:4210.45 ms3.0%
QuerySet._fetch_alldjango/db/models/query.py:22620.45 ms3.0%
ModelIterable.__iter__django/db/models/query.py:1030.45 ms3.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16120.45 ms3.0%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7680.45 ms3.0%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:910.45 ms3.0%
WhereNode.split_having_qualifydjango/db/models/sql/where.py:470.45 ms3.0%
Estimated from 31 samples; phase durations are exact. Frames from pytest and pluggy are hidden .

Hot lines in your code

announcements/tests.py:18
self.due = baker.make(
TestPostAnnouncements.setUp · Database
0.45 ms
announcements/tests.py:25
self.not_due = baker.make(
TestPostAnnouncements.setUp · Database
0.45 ms
announcements/management/commands/postannouncements.py:26
due = list(Announcement.objects.filter(posted_at__isnull=True, post_at__lte=timezone.now()))
Command.handle · Database
0.45 ms
announcements/management/commands/postannouncements.py:47
mastodon = Mastodon(
Command.handle · Mocking
0.45 ms
announcements/management/commands/postannouncements.py:64
announcement.save(update_fields=["posted_at", "post_url", "error"])
Command.handle · Database
0.45 ms
announcements/tests.py:57
self.due.refresh_from_db()
TestPostAnnouncements.test_posts_only_due_announcements · Database
0.45 ms

Fixtures

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

Database

11 queries · 6 ms

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

3×
SELECT "announcements_announcement"."id", "announcements_announcement"."content", "announcements_announcement"."visibility", "announcements_announcement"."post_at", "announcements_announcement"."posted_at", "announcements_announcement"."post_url", "announcements_announcement"."error", "announcement…

Biggest pieces of work

call _pre_setup
django/test/testcases.py:1154
11 ms
call test body
announcements/tests.py:53
2 ms
setup pytest internals 1 ms
call setUp
announcements/tests.py:18
0.90 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 15 ms c28a326 main Profile
16 hours ago CI github-actions:test passed 11 ms 9b8826a main Profile
22 hours ago CI github-actions:test passed 25 ms 4f01055 main Profile
1 week, 5 days ago CI github-actions:test passed 11 ms 8ab642e main Profile
2 weeks, 2 days ago CI github-actions:test passed 26 ms 9b75244 main Profile
2 weeks, 2 days ago CI github-actions:test passed 12 ms 9603516 main Profile
2 weeks, 4 days ago CI github-actions:test passed 26 ms 615a272 main Profile
3 weeks ago CI github-actions:test passed 10 ms d923a46 main Profile
3 weeks ago CI github-actions:test passed 21 ms 82997f8 main Profile
3 weeks ago CI github-actions:test passed 21 ms 623aa3e main Profile
3 weeks ago CI github-actions:test passed 32 ms ab6465a main Profile
3 weeks ago CI github-actions:test passed 10 ms 0c23747 main Run