Tests / announcements/tests.py
TestPostAnnouncements::test_dry_run_is_the_default
First seen 1 month, 1 week ago in 0c23747
CI
github-actions:test
13 runs
Average
22 ms
median 22 ms
max 39 ms
max 39 ms
Phases
Setup 3 ms
Call 19 ms
Teardown 0.37 ms
Categories
Database 11 ms
Test code 0.12 ms
Factories 0.08 ms
Other (Libraries, Mocking, pytest, Unsampled, ...) 11 ms
9 database queries per run
Needs 31 KB of memory (max 72 KB)
Duration per run
Where the time goes
Latest run in ci:github-actions:test, 2 weeks ago ·
open run
setup0.80 ms9.1%
_django_clear_site_cachepytest_django/plugin.py:848 if django_settings_is_configured():0.80 ms9.1%
django_settings_is_configuredpytest_django/lazy_django.py:270.80 ms9.1%
Mapping.get<frozen _collections_abc>:7950.80 ms9.1%
_Environ.__getitem__<frozen os>:7260.80 ms9.1%
call8 ms89.1%
TestPostAnnouncements.test_dry_run_is_the_defaultannouncements/tests.py:46 status_post = self._run_at(dt.datetime(2026, 6, 1, 9, 0, tzinfo=dt.UTC), dry_run=True)4 ms44.5%
TestPostAnnouncements._run_atannouncements/tests.py:42 call_command("postannouncements", *([] if dry_run else ["--no-dry-run"]))3 ms33.4%
call_commanddjango/core/management/__init__.py:1952 ms22.3%
RichCommand.executedjango_rich/management/__init__.py:342 ms22.3%
BaseCommand.executedjango/core/management/base.py:4662 ms22.3%
Command.handleannouncements/management/commands/postannouncements.py:26 due = list(Announcement.objects.filter(posted_at__isnull=True, post_at__lte=timezone.now()))0.98 ms11.1%
QuerySet.__iter__django/db/models/query.py:4390.98 ms11.1%
QuerySet._fetch_alldjango/db/models/query.py:22620.98 ms11.1%
ModelIterable.__iter__django/db/models/query.py:1030.98 ms11.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16250.98 ms11.1%
CursorWrapper.executedjango/db/backends/utils.py:790.98 ms11.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.98 ms11.1%
CursorWrapper._executedjango/db/backends/utils.py:1050.98 ms11.1%
Cursor.executepsycopg/cursor.py:1130.98 ms11.1%
Connection.waitpsycopg/connection.py:4950.98 ms11.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2060.98 ms11.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2860.98 ms11.1%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:780.98 ms11.1%
Command.handleannouncements/management/commands/postannouncements.py:34 self.console.print(0.98 ms11.1%
Console.printrich/console.py:17050.98 ms11.1%
Console._collect_renderablesrich/console.py:15600.98 ms11.1%
Console.render_strrich/console.py:14640.98 ms11.1%
Highlighter.__call__rich/highlighter.py:380.98 ms11.1%
RegexHighlighter.highlightrich/highlighter.py:770.98 ms11.1%
Text.highlight_regexrich/text.py:6180.98 ms11.1%
call_commanddjango/core/management/__init__.py:1220.98 ms11.1%
BaseCommand.create_parserdjango/core/management/base.py:3100.98 ms11.1%
CommandParser.__init__django/core/management/base.py:660.98 ms11.1%
ArgumentParser.__init__<stdlib>/argparse.py:20610.98 ms11.1%
gettext<stdlib>/gettext.py:6320.98 ms11.1%
dgettext<stdlib>/gettext.py:5930.98 ms11.1%
translation<stdlib>/gettext.py:5360.98 ms11.1%
TestPostAnnouncements._run_atannouncements/tests.py:35 mock.patch("announcements.management.commands.postannouncements.Mastodon") as mastodon_cls,0.98 ms11.1%
_patch.__enter__<stdlib>/unittest/mock.py:15720.98 ms11.1%
NonCallableMock.__new__<stdlib>/unittest/mock.py:4600.98 ms11.1%
TestPostAnnouncements.setUpannouncements/tests.py:18 self.due = baker.make(0.98 ms11.1%
makemodel_bakery/baker.py:1750.98 ms11.1%
Baker.makemodel_bakery/baker.py:4540.98 ms11.1%
Baker._makemodel_bakery/baker.py:5420.98 ms11.1%
Baker.instancemodel_bakery/baker.py:6590.98 ms11.1%
Model.savedjango/db/models/base.py:9040.98 ms11.1%
Model.save_basedjango/db/models/base.py:9960.98 ms11.1%
Model._save_tabledjango/db/models/base.py:11990.98 ms11.1%
Model._do_insertdjango/db/models/base.py:12510.98 ms11.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:870.98 ms11.1%
QuerySet._insertdjango/db/models/query.py:21410.98 ms11.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19360.98 ms11.1%
CursorWrapper.executedjango/db/backends/utils.py:790.98 ms11.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.98 ms11.1%
CursorWrapper._executedjango/db/backends/utils.py:1050.98 ms11.1%
Cursor.executepsycopg/cursor.py:1130.98 ms11.1%
Connection.waitpsycopg/connection.py:4950.98 ms11.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2060.98 ms11.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2860.98 ms11.1%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:780.98 ms11.1%
TestPostAnnouncements.setUpannouncements/tests.py:25 self.not_due = baker.make(0.98 ms11.1%
makemodel_bakery/baker.py:1750.98 ms11.1%
Baker.makemodel_bakery/baker.py:4540.98 ms11.1%
Baker._makemodel_bakery/baker.py:5420.98 ms11.1%
Baker.instancemodel_bakery/baker.py:6590.98 ms11.1%
Model.savedjango/db/models/base.py:9040.98 ms11.1%
Model.save_basedjango/db/models/base.py:9960.98 ms11.1%
Model._save_tabledjango/db/models/base.py:11990.98 ms11.1%
Model._do_insertdjango/db/models/base.py:12510.98 ms11.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:870.98 ms11.1%
QuerySet._insertdjango/db/models/query.py:21410.98 ms11.1%
SQLInsertCompiler.execute_sqldjango/db/models/sql/compiler.py:19340.98 ms11.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:260.98 ms11.1%
BaseDatabaseWrapper.cursordjango/db/backends/base/base.py:3200.98 ms11.1%
BaseDatabaseWrapper._cursordjango/db/backends/base/base.py:2980.98 ms11.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:260.98 ms11.1%
DatabaseWrapper.create_cursordjango/db/backends/postgresql/base.py:4420.98 ms11.1%
Connection.cursorpsycopg/connection.py:2590.98 ms11.1%
Cursor.__init__psycopg/cursor.py:470.98 ms11.1%
BaseCursor.__init__psycopg/_cursor_base.py:720.98 ms11.1%
TestPostAnnouncements.test_dry_run_is_the_defaultannouncements/tests.py:49 self.due.refresh_from_db()0.98 ms11.1%
Model.refresh_from_dbdjango/db/models/base.py:7880.98 ms11.1%
QuerySet.getdjango/db/models/query.py:7020.98 ms11.1%
QuerySet.__len__django/db/models/query.py:4210.98 ms11.1%
QuerySet._fetch_alldjango/db/models/query.py:22620.98 ms11.1%
ModelIterable.__iter__django/db/models/query.py:1030.98 ms11.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16250.98 ms11.1%
CursorWrapper.executedjango/db/backends/utils.py:790.98 ms11.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.98 ms11.1%
CursorWrapper._executedjango/db/backends/utils.py:1050.98 ms11.1%
Cursor.executepsycopg/cursor.py:1130.98 ms11.1%
Connection.waitpsycopg/connection.py:4950.98 ms11.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2060.98 ms11.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2860.98 ms11.1%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:780.98 ms11.1%
TransactionTestCase._post_teardowndjango/test/testcases.py:1243 self._fixture_teardown()0.98 ms11.1%
TestCase._fixture_teardowndjango/test/testcases.py:15000.98 ms11.1%
TestCase._rollback_atomicsdjango/test/testcases.py:14080.98 ms11.1%
Atomic.__exit__django/db/transaction.py:2980.98 ms11.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:260.98 ms11.1%
BaseDatabaseWrapper.savepoint_commitdjango/db/backends/base/base.py:4310.98 ms11.1%
BaseDatabaseWrapper._savepoint_commitdjango/db/backends/base/base.py:3750.98 ms11.1%
CursorWrapper.executedjango/db/backends/utils.py:790.98 ms11.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:920.98 ms11.1%
CursorWrapper._executedjango/db/backends/utils.py:1030.98 ms11.1%
Cursor.executepsycopg/cursor.py:1130.98 ms11.1%
Connection.waitpsycopg/connection.py:4950.98 ms11.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2060.98 ms11.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2860.98 ms11.1%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:780.98 ms11.1%
Estimated from 9 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.98 ms |
|
announcements/tests.py:25
self.not_due = baker.make(
TestPostAnnouncements.setUp
· Database
|
0.98 ms |
|
announcements/tests.py:35
mock.patch("announcements.management.commands.postannouncements.Mastodon") as mastodon_cls,
TestPostAnnouncements._run_at
· Mocking
|
0.98 ms |
|
announcements/tests.py:42
call_command("postannouncements", *([] if dry_run else ["--no-dry-run"]))
TestPostAnnouncements._run_at
· Libraries
|
0.98 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.98 ms |
|
announcements/management/commands/postannouncements.py:34
self.console.print(
Command.handle
· Libraries
|
0.98 ms |
|
announcements/tests.py:49
self.due.refresh_from_db()
TestPostAnnouncements.test_dry_run_is_the_default
· Database
|
0.98 ms |
Fixtures
Exact setup time| _django_clear_site_cache function | 0.18 ms |
| _template_string_if_invalid_marker function | 0.05 ms |
| _dj_autoclear_mailbox function | 0.04 ms |
| _django_db_marker function | 0.03 ms |
| _django_isolate_apps function | 0.03 ms |
| _live_server_helper function | 0.03 ms |
| _django_set_urlconf function | 0.02 ms |
| monkeypatch function | 0.02 ms |
Database
9 queries · 3 msNo repeated queries.
Biggest pieces of work
|
call test body
announcements/tests.py:46
|
5 ms |
|
call setUp
announcements/tests.py:18
|
2 ms |
|
call _post_teardown
django/test/testcases.py:1243
|
0.98 ms |
|
setup fixture _django_clear_site_cache
pytest_django/plugin.py:848
|
0.80 ms |
Reliability
14 results · 0 CI failures · 0 local failuresThis test hasn't failed recently.
History
Latest 14 results, oldest first in the strip| When | Environment | Outcome | Duration | |
|---|---|---|---|---|
| 2 weeks ago | CI github-actions:test | passed | 9 ms | Profile |
| 2 weeks, 5 days ago | CI github-actions:test | passed | 25 ms | Profile |
| 2 weeks, 6 days ago | CI github-actions:test | passed | 12 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 11 ms | Profile |
| 3 weeks ago | CI github-actions:test | passed | 22 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 11 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 22 ms | Profile |
| 1 month ago | CI github-actions:test | passed | 16 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 39 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 13 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 39 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 37 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 32 ms | Profile |
| 1 month, 1 week ago | CI github-actions:test | passed | 14 ms | Run |