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

TestPostAnnouncements::test_records_error_and_leaves_row_unposted

First seen 14 hours ago in 0c23747
CI github-actions:test 4 runs
Average
21 ms
median 19 ms
max 31 ms
Phases
Setup 0.97 ms Call 20 ms Teardown 0.30 ms
Categories
Database 11 ms Factories 0.30 ms Other (Libraries, Mocking, pytest, Unsampled, ...) 9 ms

10 database queries per run

Needs 38 KB of memory (max 60 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, 8 hours ago · open run
Show pytest frames
call13 ms93.0%
TestPostAnnouncements.test_records_error_and_leaves_row_unpostedannouncements/tests.py:83 self._run_at(dt.datetime(2026, 6, 1, 9, 0, tzinfo=dt.UTC), status_post=failing)7 ms50.7%
TestPostAnnouncements._run_atannouncements/tests.py:42 call_command("postannouncements", *([] if dry_run else ["--no-dry-run"]))6 ms42.3%
call_commanddjango/core/management/__init__.py:1956 ms42.3%
RichCommand.executedjango_rich/management/__init__.py:346 ms42.3%
BaseCommand.executedjango/core/management/base.py:4666 ms42.3%
Command.handleannouncements/management/commands/postannouncements.py:57 announcement.save(update_fields=["error"])4 ms25.4%
Model.savedjango/db/models/base.py:9044 ms25.4%
Model.save_basedjango/db/models/base.py:9964 ms25.4%
Model._save_tabledjango/db/models/base.py:11404 ms25.4%
Model._do_updatedjango/db/models/base.py:12444 ms25.4%
QuerySet._updatedjango/db/models/query.py:14484 ms25.4%
SQLUpdateCompiler.execute_returning_sqldjango/db/models/sql/compiler.py:21504 ms25.4%
SQLUpdateCompiler.execute_sqldjango/db/models/sql/compiler.py:21214 ms25.4%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16254 ms25.4%
CursorWrapper.executedjango/db/backends/utils.py:794 ms25.4%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:924 ms25.4%
CursorWrapper._executedjango/db/backends/utils.py:1054 ms25.4%
Cursor.executepsycopg/cursor.py:1134 ms25.4%
Connection.waitpsycopg/connection.py:4954 ms25.4%
BaseCursor._execute_genpsycopg/_cursor_base.py:2054 ms25.4%
BaseCursor._convert_querypsycopg/_cursor_base.py:4654 ms25.4%
PostgresClientQuery.convertpsycopg/_queries.py:2734 ms25.4%
PostgresQuery._ensure_bytespsycopg/_queries.py:1674 ms25.4%
conn_encodingpsycopg/_encodings.py:874 ms25.4%
Command.handleannouncements/management/commands/postannouncements.py:26 due = list(Announcement.objects.filter(posted_at__isnull=True, post_at__lte=timezone.now()))1 ms8.5%
QuerySet.__iter__django/db/models/query.py:4391 ms8.5%
QuerySet._fetch_alldjango/db/models/query.py:22621 ms8.5%
ModelIterable.__iter__django/db/models/query.py:1031 ms8.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16121 ms8.5%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7961 ms8.5%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5791 ms8.5%
WhereNode.as_sqldjango/db/models/sql/where.py:1511 ms8.5%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5791 ms8.5%
BuiltinLookup.as_sqldjango/db/models/lookups.py:2431 ms8.5%
BuiltinLookup.process_lhsdjango/db/models/lookups.py:2351 ms8.5%
Command.handleannouncements/management/commands/postannouncements.py:67 self.console.print("Done announcing 🎉")1 ms8.5%
Console.printrich/console.py:17051 ms8.5%
Console._collect_renderablesrich/console.py:15601 ms8.5%
Console.render_strrich/console.py:14641 ms8.5%
Highlighter.__call__rich/highlighter.py:381 ms8.5%
RegexHighlighter.highlightrich/highlighter.py:771 ms8.5%
Text.highlight_regexrich/text.py:6181 ms8.5%
TestPostAnnouncements._run_atannouncements/tests.py:35 mock.patch("announcements.management.commands.postannouncements.Mastodon") as mastodon_cls,1 ms8.5%
_patch.__enter__<stdlib>/unittest/mock.py:15681 ms8.5%
MagicMixin.__init__<stdlib>/unittest/mock.py:21821 ms8.5%
MagicMixin._mock_set_magics<stdlib>/unittest/mock.py:22041 ms8.5%
TransactionTestCase._pre_setupdjango/test/testcases.py:1167 cls._fixture_setup()2 ms16.9%
TestCase._fixture_setupdjango/test/testcases.py:14812 ms16.9%
TestCase._enter_atomicsdjango/test/testcases.py:13992 ms16.9%
Atomic.__enter__django/db/transaction.py:2232 ms16.9%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms16.9%
BaseDatabaseWrapper.savepointdjango/db/backends/base/base.py:3901 ms8.5%
BaseDatabaseWrapper._savepoint_alloweddjango/db/backends/base/base.py:3791 ms8.5%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:4541 ms8.5%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:3041 ms8.5%
BaseDatabaseWrapper.savepointdjango/db/backends/base/base.py:4001 ms8.5%
BaseDatabaseWrapper._savepointdjango/db/backends/base/base.py:3671 ms8.5%
CursorWrapper.executedjango/db/backends/utils.py:791 ms8.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms8.5%
CursorWrapper._executedjango/db/backends/utils.py:1031 ms8.5%
Cursor.executepsycopg/cursor.py:1131 ms8.5%
Connection.waitpsycopg/connection.py:4951 ms8.5%
BaseCursor._execute_genpsycopg/_cursor_base.py:2061 ms8.5%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2861 ms8.5%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:781 ms8.5%
TestPostAnnouncements.setUpannouncements/tests.py:25 self.not_due = baker.make(1 ms8.5%
makemodel_bakery/baker.py:1751 ms8.5%
Baker.makemodel_bakery/baker.py:4541 ms8.5%
Baker._makemodel_bakery/baker.py:5421 ms8.5%
Baker.instancemodel_bakery/baker.py:6591 ms8.5%
TestPostAnnouncements.test_records_error_and_leaves_row_unpostedannouncements/tests.py:85 self.due.refresh_from_db()1 ms8.5%
Model.refresh_from_dbdjango/db/models/base.py:7881 ms8.5%
QuerySet.getdjango/db/models/query.py:7021 ms8.5%
QuerySet.__len__django/db/models/query.py:4211 ms8.5%
QuerySet._fetch_alldjango/db/models/query.py:22621 ms8.5%
ModelIterable.__iter__django/db/models/query.py:1031 ms8.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16251 ms8.5%
CursorWrapper.executedjango/db/backends/utils.py:791 ms8.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms8.5%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms8.5%
Cursor.executepsycopg/cursor.py:1141 ms8.5%
Estimated from 11 samples; phase durations are exact. Frames from pytest and pluggy are hidden .

Hot lines in your code

announcements/management/commands/postannouncements.py:57
announcement.save(update_fields=["error"])
Command.handle · Database
4 ms
announcements/tests.py:25
self.not_due = baker.make(
TestPostAnnouncements.setUp · Factories
1 ms
announcements/tests.py:35
mock.patch("announcements.management.commands.postannouncements.Mastodon") as mastodon_cls,
TestPostAnnouncements._run_at · Mocking
1 ms
announcements/management/commands/postannouncements.py:26
due = list(Announcement.objects.filter(posted_at__isnull=True, post_at__lte=timezone.now()))
Command.handle · Database
1 ms
announcements/management/commands/postannouncements.py:67
self.console.print("Done announcing 🎉")
Command.handle · Libraries
1 ms
announcements/tests.py:85
self.due.refresh_from_db()
TestPostAnnouncements.test_records_error_and_leaves_row_unposted · Database
1 ms

Fixtures

Exact setup time
_dj_autoclear_mailbox function 0.04 ms
_template_string_if_invalid_marker function 0.03 ms
_django_db_marker function 0.03 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.02 ms
monkeypatch function 0.02 ms

Database

10 queries · 7 ms
No repeated queries.

Biggest pieces of work

call test body
announcements/tests.py:83
8 ms
call _pre_setup
django/test/testcases.py:1167
2 ms
call pytest internals 1 ms
call setUp
announcements/tests.py:25
1 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
8 hours ago CI github-actions:test passed 14 ms d923a46 main Profile
8 hours ago CI github-actions:test passed 18 ms 82997f8 main Profile
9 hours ago CI github-actions:test passed 21 ms 623aa3e main Profile
13 hours ago CI github-actions:test passed 31 ms ab6465a main Profile
14 hours ago CI github-actions:test passed 10 ms 0c23747 main Run