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

ProfileUploadTest::test_invalid_part

First seen 8 hours ago in 78a4357
CI github-actions:test 5 runs
Average
48 ms
median 50 ms
max 58 ms
Phases
Setup 0.70 ms Call 47 ms Teardown 0.17 ms
Categories
Database 12 ms App code 1 ms Test code 0.46 ms Other (Libraries, Unsampled, Serialization, Logging) 34 ms

22 database queries per run

Needs 20 KB of memory (max 64 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, an hour ago · open run
Show pytest frames
call51 ms98.4%
ProfileUploadTest.test_invalid_partapps/api/tests.py:891 response = self.upload(self.document() | {"part": part})47 ms89.8%
ProfileUploadTest.uploadapps/api/tests.py:487 response = self.client.post(42 ms81.3%
Client.postdjango/test/client.py:115342 ms81.3%
RequestFactory.postdjango/test/client.py:49942 ms81.3%
RequestFactory.genericdjango/test/client.py:67142 ms81.3%
Client.requestdjango/test/client.py:108242 ms81.3%
ClientHandler.__call__django/test/client.py:17327 ms51.3%
BaseHandler.load_middlewaredjango/core/handlers/base.py:6227 ms51.3%
WhiteNoiseMiddleware.__init__whitenoise/middleware.py:10427 ms51.3%
WhiteNoise.add_fileswhitenoise/base.py:10827 ms51.3%
WhiteNoise.update_files_dictionarywhitenoise/base.py:12018 ms34.2%
WhiteNoise.add_file_to_dictionarywhitenoise/base.py:13118 ms34.2%
WhiteNoise.get_static_filewhitenoise/base.py:2039 ms17.1%
WhiteNoise.add_cache_headerswhitenoise/base.py:2247 ms12.8%
WhiteNoiseMiddleware.immutable_file_testwhitenoise/middleware.py:1767 ms12.8%
WhiteNoiseMiddleware.get_static_urlwhitenoise/middleware.py:1977 ms12.8%
URLMixin.urldebug_toolbar/panels/staticfiles.py:217 ms12.8%
<GC>~7 ms12.8%
WhiteNoise.get_static_filewhitenoise/base.py:2089 ms17.1%
StaticFile.__init__whitenoise/responders.py:772 ms4.3%
StaticFile.get_alternativeswhitenoise/responders.py:1982 ms4.3%
StaticFile.get_alternatives.<locals>.<lambda>whitenoise/responders.py:1982 ms4.3%
<GC>~2 ms4.3%
StaticFile.__init__whitenoise/responders.py:722 ms4.3%
StaticFile.__init__whitenoise/responders.py:742 ms4.3%
parsedate<stdlib>/email/_parseaddr.py:1852 ms4.3%
WhiteNoise.update_files_dictionarywhitenoise/base.py:1157 ms12.8%
scantreewhitenoise/base.py:2627 ms12.8%
scantreewhitenoise/base.py:2627 ms12.8%
scantreewhitenoise/base.py:2624 ms8.6%
scantreewhitenoise/base.py:2624 ms8.6%
scantreewhitenoise/base.py:2642 ms4.3%
scantreewhitenoise/base.py:2622 ms4.3%
scantreewhitenoise/base.py:2642 ms4.3%
scantreewhitenoise/base.py:2642 ms4.3%
ClientHandler.__call__django/test/client.py:18616 ms29.9%
BaseHandler.get_responsedjango/core/handlers/base.py:14116 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
DebugToolbarMiddleware.__call__debug_toolbar/middleware.py:13016 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
MiddlewareMixin.__call__django/utils/deprecation.py:30916 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
WhiteNoiseMiddleware.__call__whitenoise/middleware.py:12316 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
MiddlewareMixin.__call__django/utils/deprecation.py:30916 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
MiddlewareMixin.__call__django/utils/deprecation.py:30916 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
MiddlewareMixin.__call__django/utils/deprecation.py:30916 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
MiddlewareMixin.__call__django/utils/deprecation.py:30916 ms29.9%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5516 ms29.9%
MiddlewareMixin.__call__django/utils/deprecation.py:30913 ms25.7%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5513 ms25.7%
MiddlewareMixin.__call__django/utils/deprecation.py:30913 ms25.7%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5513 ms25.7%
AccountMiddleware.<locals>.middlewareallauth/account/middleware.py:3413 ms25.7%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5513 ms25.7%
BaseHandler._get_responsedjango/core/handlers/base.py:19813 ms25.7%
csrf_exempt.<locals>._view_wrapperdjango/views/decorators/csrf.py:6513 ms25.7%
jsonify_errors.<locals>.wrapped_viewapps/api/urls.py:3713 ms25.7%
require_http_methods.<locals>.decorator.<locals>.innerdjango/views/decorators/http.py:6413 ms25.7%
api_request.<locals>.decorator.<locals>.wrapped_viewapps/api/urls.py:72 project = get_object_or_404(Project, secrettokens__token=request.headers.get("Authorization"))9 ms17.1%
get_object_or_404django/shortcuts.py:909 ms17.1%
QuerySet.getdjango/db/models/query.py:6357 ms12.8%
QuerySet.__len__django/db/models/query.py:3727 ms12.8%
QuerySet._fetch_alldjango/db/models/query.py:20007 ms12.8%
ModelIterable.__iter__django/db/models/query.py:957 ms12.8%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16244 ms8.6%
CursorWrapper.executedjango/db/backends/utils.py:794 ms8.6%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:924 ms8.6%
CursorWrapper._executedjango/db/backends/utils.py:1054 ms8.6%
Cursor.executepsycopg/cursor.py:1134 ms8.6%
Connection.waitpsycopg/connection.py:4954 ms8.6%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms4.3%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:3182 ms4.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16112 ms4.3%
SQLCompiler.as_sqldjango/db/models/sql/compiler.py:7672 ms4.3%
SQLCompiler.pre_sql_setupdjango/db/models/sql/compiler.py:862 ms4.3%
SQLCompiler.setup_querydjango/db/models/sql/compiler.py:752 ms4.3%
SQLCompiler.get_selectdjango/db/models/sql/compiler.py:3172 ms4.3%
SQLCompiler.compiledjango/db/models/sql/compiler.py:5782 ms4.3%
Col.as_sqldjango/db/models/expressions.py:13252 ms4.3%
api_request.<locals>.decorator.<locals>.wrapped_viewapps/api/urls.py:73 touch_token(request.headers.get("Authorization"))4 ms8.6%
touch_tokenapps/api/urls.py:59 SecretTokens.objects.filter(pk__in=list(stale)).update(date_last_used=now)4 ms8.6%
QuerySet.__iter__django/db/models/query.py:3902 ms4.3%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms4.3%
FlatValuesListIterable.__iter__django/db/models/query.py:2772 ms4.3%
SQLCompiler.results_iterdjango/db/models/sql/compiler.py:15732 ms4.3%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms4.3%
CursorWrapper.executedjango/db/backends/utils.py:792 ms4.3%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms4.3%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms4.3%
Cursor.executepsycopg/cursor.py:1132 ms4.3%
Connection.waitpsycopg/connection.py:4952 ms4.3%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms4.3%
QuerySet.filterdjango/db/models/query.py:15422 ms4.3%
QuerySet._filter_or_excludedjango/db/models/query.py:15602 ms4.3%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:15702 ms4.3%
Query.add_qdjango/db/models/sql/query.py:16712 ms4.3%
Query._add_qdjango/db/models/sql/query.py:17032 ms4.3%
Query.build_filterdjango/db/models/sql/query.py:16112 ms4.3%
Query._get_coldjango/db/models/sql/query.py:4512 ms4.3%
MiddlewareMixin.__call__django/utils/deprecation.py:3082 ms4.3%
MessageMiddleware.process_requestdjango/contrib/messages/middleware.py:122 ms4.3%
default_storagedjango/contrib/messages/storage/__init__.py:122 ms4.3%
FallbackStorage.__init__django/contrib/messages/storage/fallback.py:172 ms4.3%
ProfileUploadTest.uploadapps/api/tests.py:485 body = json.dumps(body).encode()4 ms8.6%
dumps<stdlib>/json/__init__.py:1842 ms4.3%
dumps<stdlib>/json/__init__.py:2342 ms4.3%
JSONEncoder.encode<stdlib>/json/encoder.py:2022 ms4.3%
JSONEncoder.iterencode<stdlib>/json/encoder.py:2632 ms4.3%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()4 ms8.6%
TestCase._fixture_teardowndjango/test/testcases.py:14942 ms4.3%
TestCase._should_check_constraintsdjango/test/testcases.py:15032 ms4.3%
DatabaseWrapper.is_usabledjango/db/backends/postgresql/base.py:4922 ms4.3%
Cursor.executepsycopg/cursor.py:1132 ms4.3%
Connection.waitpsycopg/connection.py:4952 ms4.3%
TestCase._fixture_teardowndjango/test/testcases.py:14972 ms4.3%
TestCase._rollback_atomicsdjango/test/testcases.py:14052 ms4.3%
Atomic.__exit__django/db/transaction.py:2862 ms4.3%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms4.3%
BaseDatabaseWrapper.savepoint_commitdjango/db/backends/base/base.py:4312 ms4.3%
BaseDatabaseWrapper._savepoint_commitdjango/db/backends/base/base.py:3752 ms4.3%
CursorWrapper.executedjango/db/backends/utils.py:792 ms4.3%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms4.3%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms4.3%
Cursor.executepsycopg/cursor.py:1132 ms4.3%
Connection.waitpsycopg/connection.py:4952 ms4.3%
Estimated from 23 samples; phase durations are exact. Frames from pytest and pluggy are hidden .

Hot lines in your code

apps/api/tests.py:487
response = self.client.post(
ProfileUploadTest.upload · Libraries
29 ms
apps/api/urls.py:72
project = get_object_or_404(Project, secrettokens__token=request.headers.get("Authorization"))
api_request.<locals>.decorator.<locals>.wrapped_view · Database
9 ms
apps/api/tests.py:485
body = json.dumps(body).encode()
ProfileUploadTest.upload · Serialization
4 ms
apps/api/urls.py:59
SecretTokens.objects.filter(pk__in=list(stale)).update(date_last_used=now)
touch_token · Database
4 ms

Fixtures

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

Database

22 queries · 7 ms

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

4×
SELECT "projects_project"."id", "projects_project"."organization_id", "projects_project"."name", "projects_project"."slug", "projects_project"."public", "projects_project"."description", "projects_project"."date_created", "projects_project"."date_updated", "projects_project"."created_by_id" FROM "p…
4×
SELECT "projects_secrettokens"."id" AS "pk" FROM "projects_secrettokens" WHERE (("projects_secrettokens"."date_last_used" < %s OR "projects_secrettokens"."date_last_used" IS NULL) AND "projects_secrettokens"."token" = %s) FOR UPDATE SKIP LOCKED

Biggest pieces of work

call test body
apps/api/tests.py:891
47 ms
call _post_teardown
django/test/testcases.py:1240
4 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
an hour ago CI github-actions:test passed 52 ms 9caa567 main Profile
an hour ago CI github-actions:test passed 50 ms ec75501 main Profile
8 hours ago CI github-actions:test passed 58 ms d2c12e5 main Profile
8 hours ago CI github-actions:test passed 30 ms 0b902f6 main Profile
8 hours ago CI github-actions:test passed 49 ms 78a4357 main Profile