flakytest.dev anze3db flakytest
Tests / apps/projects/tests.py

AnalyticsTest::test_resolve_scope

First seen 9 hours ago in 78a4357
CI github-actions:test 5 runs
Average
9 ms
median 10 ms
max 10 ms
Phases
Setup 0.66 ms Call 8 ms Teardown 0.18 ms
Categories
Database 8 ms Other (Unsampled, Libraries, pytest) 0.84 ms

11 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, 2 hours ago · open run
Hide pytest frames
call9 ms90.2%
CallInfo.from_call_pytest/runner.py:3539 ms90.2%
call_and_report.<locals>.<lambda>_pytest/runner.py:2459 ms90.2%
HookCaller.__call__pluggy/_hooks.py:5129 ms90.2%
PluginManager._hookexecpluggy/_manager.py:1209 ms90.2%
_multicallpluggy/_callers.py:1219 ms90.2%
pytest_runtest_call_pytest/runner.py:1799 ms90.2%
_django_setup_unittest.<locals>.non_debugging_runtestpytest_django/plugin.py:5739 ms90.2%
SimpleTestCase.__call__django/test/testcases.py:3139 ms90.2%
SimpleTestCase._setup_and_calldjango/test/testcases.py:3687 ms72.1%
TestCase.__call__<stdlib>/unittest/case.py:7477 ms72.1%
TestCase.run<stdlib>/unittest/case.py:6917 ms72.1%
TestCase._callTestMethod<stdlib>/unittest/case.py:6377 ms72.1%
AnalyticsTest.test_resolve_scopeapps/projects/tests.py:724 self.assertEqual(resolve_scope(self.project, "ci").environments, [self.ci])2 ms18.0%
resolve_scopeapps/projects/analytics.py:206 environments=list(Environment.objects.filter(project=project, kind=env)),2 ms18.0%
QuerySet.__iter__django/db/models/query.py:3902 ms18.0%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms18.0%
ModelIterable.__iter__django/db/models/query.py:952 ms18.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16222 ms18.0%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms18.0%
BaseDatabaseWrapper.cursordjango/db/backends/base/base.py:3202 ms18.0%
BaseDatabaseWrapper._cursordjango/db/backends/base/base.py:2982 ms18.0%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms18.0%
DatabaseWrapper.create_cursordjango/db/backends/postgresql/base.py:4352 ms18.0%
AdaptersMap.get_loaderpsycopg/_adapters_map.py:2732 ms18.0%
AnalyticsTest.test_resolve_scopeapps/projects/tests.py:7252 ms18.0%
resolve_scopeapps/projects/analytics.py:206 environments=list(Environment.objects.filter(project=project, kind=env)),2 ms18.0%
QuerySet.__iter__django/db/models/query.py:3902 ms18.0%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms18.0%
ModelIterable.__iter__django/db/models/query.py:952 ms18.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms18.0%
CursorWrapper.executedjango/db/backends/utils.py:792 ms18.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms18.0%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms18.0%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms18.0%
Cursor.executepsycopg/cursor.py:1132 ms18.0%
Connection.waitpsycopg/connection.py:4952 ms18.0%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms18.0%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2862 ms18.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms18.0%
AnalyticsTest.test_resolve_scopeapps/projects/tests.py:7262 ms18.0%
resolve_scopeapps/projects/analytics.py:198 selected = Environment.objects.filter(project=project, name=env).first()2 ms18.0%
QuerySet.firstdjango/db/models/query.py:11452 ms18.0%
QuerySet.__iter__django/db/models/query.py:3902 ms18.0%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms18.0%
ModelIterable.__iter__django/db/models/query.py:952 ms18.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms18.0%
CursorWrapper.executedjango/db/backends/utils.py:792 ms18.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms18.0%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms18.0%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms18.0%
Cursor.executepsycopg/cursor.py:1132 ms18.0%
Connection.waitpsycopg/connection.py:4952 ms18.0%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms18.0%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2862 ms18.0%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:782 ms18.0%
AnalyticsTest.test_resolve_scopeapps/projects/tests.py:7302 ms18.0%
resolve_scopeapps/projects/analytics.py:198 selected = Environment.objects.filter(project=project, name=env).first()2 ms18.0%
QuerySet.firstdjango/db/models/query.py:11452 ms18.0%
QuerySet.__iter__django/db/models/query.py:3902 ms18.0%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms18.0%
ModelIterable.__iter__django/db/models/query.py:952 ms18.0%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms18.0%
CursorWrapper.executedjango/db/backends/utils.py:792 ms18.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms18.0%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms18.0%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms18.0%
Cursor.executepsycopg/cursor.py:1132 ms18.0%
Connection.waitpsycopg/connection.py:4952 ms18.0%
SimpleTestCase._setup_and_calldjango/test/testcases.py:3712 ms18.0%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()2 ms18.0%
TestCase._fixture_teardowndjango/test/testcases.py:14952 ms18.0%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4832 ms18.0%
CursorWrapper.executedjango/db/backends/utils.py:792 ms18.0%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms18.0%
QueryTracker._django_wrapperflakytest/profiling/dbtrack.py:1002 ms18.0%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms18.0%
Cursor.executepsycopg/cursor.py:1132 ms18.0%
Connection.waitpsycopg/connection.py:4952 ms18.0%
teardown0.21 ms2.1%
CallInfo.from_call_pytest/runner.py:3530.21 ms2.1%
call_and_report.<locals>.<lambda>_pytest/runner.py:2450.21 ms2.1%
HookCaller.__call__pluggy/_hooks.py:5120.21 ms2.1%
PluginManager._hookexecpluggy/_manager.py:1200.21 ms2.1%
_multicallpluggy/_callers.py:1210.21 ms2.1%
pytest_runtest_teardown_pytest/runner.py:1940.21 ms2.1%
SetupState.teardown_exact_pytest/runner.py:5550.21 ms2.1%
FixtureDef.finish_pytest/fixtures.py:10460.21 ms2.1%
Estimated from 6 samples; phase durations are exact. Frames from pytest and pluggy are shown .

Hot lines in your code

apps/projects/analytics.py:206
environments=list(Environment.objects.filter(project=project, kind=env)),
resolve_scope · Database
4 ms
apps/projects/analytics.py:198
selected = Environment.objects.filter(project=project, name=env).first()
resolve_scope · Database
4 ms

Fixtures

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

Database

11 queries · 4 ms

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

6×
SELECT "projects_environment"."id", "projects_environment"."project_id", "projects_environment"."name", "projects_environment"."kind", "projects_environment"."provider", "projects_environment"."details", "projects_environment"."date_first_seen", "projects_environment"."date_last_seen" FROM "project…

Biggest pieces of work

call test body
apps/projects/tests.py:724
7 ms
call _post_teardown
django/test/testcases.py:1240
2 ms
teardown pytest internals 0.21 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
2 hours ago CI github-actions:test passed 10 ms 9caa567 main Profile
2 hours ago CI github-actions:test passed 9 ms ec75501 main Profile
9 hours ago CI github-actions:test passed 10 ms d2c12e5 main Profile
9 hours ago CI github-actions:test passed 6 ms 0b902f6 main Profile
9 hours ago CI github-actions:test passed 10 ms 78a4357 main Profile