Tests / announcements/tests.py
TestPostAnnouncements::test_posts_only_due_announcements
First seen 14 hours ago in 0c23747
CI
github-actions:test
4 runs
Average
21 ms
median 21 ms
max 32 ms
max 32 ms
Phases
Setup 2 ms
Call 18 ms
Teardown 0.29 ms
Categories
Database 16 ms
Other (pytest, Libraries, Mocking, Unsampled) 5 ms
11 database queries per run
Needs 35 KB of memory (max 44 KB)
Duration per run
Where the time goes
Latest run in ci:github-actions:test, 8 hours ago ·
open run
call8 ms86.9%
TestPostAnnouncements.test_posts_only_due_announcementsannouncements/tests.py:53 status_post = self._run_at(dt.datetime(2026, 6, 1, 9, 0, tzinfo=dt.UTC))3 ms34.8%
TestPostAnnouncements._run_atannouncements/tests.py:42 call_command("postannouncements", *([] if dry_run else ["--no-dry-run"]))3 ms34.8%
call_commanddjango/core/management/__init__.py:1953 ms34.8%
RichCommand.executedjango_rich/management/__init__.py:343 ms34.8%
BaseCommand.executedjango/core/management/base.py:4663 ms34.8%
Command.handleannouncements/management/commands/postannouncements.py:26 due = list(Announcement.objects.filter(posted_at__isnull=True, post_at__lte=timezone.now()))2 ms17.4%
QuerySet.__iter__django/db/models/query.py:4392 ms17.4%
QuerySet._fetch_alldjango/db/models/query.py:22622 ms17.4%
ModelIterable.__iter__django/db/models/query.py:1032 ms17.4%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16122 ms17.4%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7682 ms17.4%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:892 ms17.4%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:782 ms17.4%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3192 ms17.4%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5792 ms17.4%
Command.handleannouncements/management/commands/postannouncements.py:47 mastodon = Mastodon(2 ms17.4%
CallableMixin.__call__<stdlib>/unittest/mock.py:11752 ms17.4%
TestPostAnnouncements.setUpannouncements/tests.py:18 self.due = baker.make(2 ms17.4%
makemodel_bakery/baker.py:1752 ms17.4%
Baker.makemodel_bakery/baker.py:4542 ms17.4%
Baker._makemodel_bakery/baker.py:5422 ms17.4%
Baker.instancemodel_bakery/baker.py:6592 ms17.4%
Model.savedjango/db/models/base.py:9042 ms17.4%
Model.save_basedjango/db/models/base.py:9962 ms17.4%
Model._save_tabledjango/db/models/base.py:11992 ms17.4%
Model._do_insertdjango/db/models/base.py:12512 ms17.4%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms17.4%
QuerySet._insertdjango/db/models/query.py:21412 ms17.4%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19362 ms17.4%
CursorWrapper.executedjango/db/backends/utils.py:792 ms17.4%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms17.4%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms17.4%
Cursor.executepsycopg/cursor.py:1132 ms17.4%
Connection.waitpsycopg/connection.py:4952 ms17.4%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms17.4%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2862 ms17.4%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms17.4%
TestPostAnnouncements.setUpannouncements/tests.py:25 self.not_due = baker.make(2 ms17.4%
makemodel_bakery/baker.py:1752 ms17.4%
Baker.makemodel_bakery/baker.py:4542 ms17.4%
Baker._makemodel_bakery/baker.py:5422 ms17.4%
Baker.instancemodel_bakery/baker.py:6592 ms17.4%
Model.savedjango/db/models/base.py:9042 ms17.4%
Model.save_basedjango/db/models/base.py:9962 ms17.4%
Model._save_tabledjango/db/models/base.py:11992 ms17.4%
Model._do_insertdjango/db/models/base.py:12512 ms17.4%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms17.4%
QuerySet._insertdjango/db/models/query.py:21412 ms17.4%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19362 ms17.4%
CursorWrapper.executedjango/db/backends/utils.py:792 ms17.4%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms17.4%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms17.4%
Cursor.executepsycopg/cursor.py:1132 ms17.4%
Connection.waitpsycopg/connection.py:4952 ms17.4%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms17.4%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:3122 ms17.4%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms17.4%
Estimated from 5 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
|
2 ms |
|
announcements/tests.py:25
self.not_due = baker.make(
TestPostAnnouncements.setUp
· Database
|
2 ms |
|
announcements/management/commands/postannouncements.py:26
due = list(Announcement.objects.filter(posted_at__isnull=True, post_at__lte=timezone.now()))
Command.handle
· Database
|
2 ms |
|
announcements/management/commands/postannouncements.py:47
mastodon = Mastodon(
Command.handle
· Mocking
|
2 ms |
Fixtures
Exact setup time| _django_db_marker function | 0.12 ms |
| _dj_autoclear_mailbox function | 0.06 ms |
| _template_string_if_invalid_marker function | 0.05 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
11 queries · 3 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 setUp
announcements/tests.py:18
|
3 ms |
|
call test body
announcements/tests.py:53
|
3 ms |
| call pytest internals | 2 ms |
Reliability
5 results · 0 CI failures · 0 local failuresThis test hasn't failed recently.
History
Latest 5 results, oldest first in the strip| When | Environment | Outcome | Duration | |
|---|---|---|---|---|
| 8 hours ago | CI github-actions:test | passed | 10 ms | Profile |
| 8 hours ago | CI github-actions:test | passed | 21 ms | Profile |
| 8 hours ago | CI github-actions:test | passed | 21 ms | Profile |
| 13 hours ago | CI github-actions:test | passed | 32 ms | Profile |
| 14 hours ago | CI github-actions:test | passed | 10 ms | Run |