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

ProfileUploadTest::test_invalid_part

First seen 1 month, 1 week ago in 78a4357
CI github-actions:test 15 runs
Average
45 ms
median 49 ms
max 71 ms
Phases
Setup 0.65 ms Call 45 ms Teardown 0.16 ms
Categories
Database 12 ms App code 3 ms Test code 0.36 ms Other (Libraries, Serialization, Unsampled, Logging, ...) 31 ms

22 database queries per run

Needs 10 KB of memory (max 64 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, 2 weeks ago · open run
Show pytest frames
call40 ms98.2%
ProfileUploadTest.test_invalid_partapps/api/tests.py:891 response = self.upload(self.document() | {"part": part})39 ms94.1%
ProfileUploadTest.uploadapps/api/tests.py:487 response = self.client.post(35 ms86.0%
Client.postdjango/test/client.py:115335 ms86.0%
RequestFactory.postdjango/test/client.py:49935 ms86.0%
RequestFactory.genericdjango/test/client.py:67135 ms86.0%
Client.requestdjango/test/client.py:108235 ms86.0%
ClientHandler.__call__django/test/client.py:17325 ms61.4%
BaseHandler.load_middlewaredjango/core/handlers/base.py:6225 ms61.4%
WhiteNoiseMiddleware.__init__whitenoise/middleware.py:11113 ms32.7%
WhiteNoise.add_fileswhitenoise/base.py:10813 ms32.7%
WhiteNoise.update_files_dictionarywhitenoise/base.py:12013 ms32.7%
WhiteNoise.add_file_to_dictionarywhitenoise/base.py:13113 ms32.7%
WhiteNoise.get_static_filewhitenoise/base.py:20813 ms32.7%
StaticFile.__init__whitenoise/responders.py:7213 ms32.7%
StaticFile.get_file_statswhitenoise/responders.py:15713 ms32.7%
__init____init__:-113 ms32.7%
FileEntry.__init__whitenoise/responders.py:26413 ms32.7%
WhiteNoiseMiddleware.__init__whitenoise/middleware.py:10412 ms28.7%
WhiteNoise.add_fileswhitenoise/base.py:10812 ms28.7%
WhiteNoise.update_files_dictionarywhitenoise/base.py:12010 ms24.6%
WhiteNoise.add_file_to_dictionarywhitenoise/base.py:1318 ms20.5%
WhiteNoise.get_static_filewhitenoise/base.py:2088 ms20.5%
StaticFile.__init__whitenoise/responders.py:773 ms8.2%
StaticFile.get_alternativeswhitenoise/responders.py:2003 ms8.2%
__init____init__:-12 ms4.1%
Headers.__init__<stdlib>/wsgiref/headers.py:432 ms4.1%
StaticFile.__init__whitenoise/responders.py:732 ms4.1%
StaticFile.get_headerswhitenoise/responders.py:1782 ms4.1%
parsedate<stdlib>/email/_parseaddr.py:1852 ms4.1%
StaticFile.__init__whitenoise/responders.py:722 ms4.1%
StaticFile.get_file_statswhitenoise/responders.py:1612 ms4.1%
__init____init__:-12 ms4.1%
FileEntry.__init__whitenoise/responders.py:2632 ms4.1%
StaticFile.__init__whitenoise/responders.py:742 ms4.1%
Headers.__getitem__<stdlib>/wsgiref/headers.py:832 ms4.1%
WhiteNoise.update_files_dictionarywhitenoise/base.py:1152 ms4.1%
scantreewhitenoise/base.py:2622 ms4.1%
scantreewhitenoise/base.py:2622 ms4.1%
scantreewhitenoise/base.py:2622 ms4.1%
scantreewhitenoise/base.py:2622 ms4.1%
scantreewhitenoise/base.py:2642 ms4.1%
ClientHandler.__call__django/test/client.py:18610 ms24.6%
BaseHandler.get_responsedjango/core/handlers/base.py:1418 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
DebugToolbarMiddleware.__call__debug_toolbar/middleware.py:1308 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
MiddlewareMixin.__call__django/utils/deprecation.py:3098 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
WhiteNoiseMiddleware.__call__whitenoise/middleware.py:1238 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
MiddlewareMixin.__call__django/utils/deprecation.py:3098 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
MiddlewareMixin.__call__django/utils/deprecation.py:3098 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
MiddlewareMixin.__call__django/utils/deprecation.py:3098 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
MiddlewareMixin.__call__django/utils/deprecation.py:3098 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
MiddlewareMixin.__call__django/utils/deprecation.py:3098 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
MiddlewareMixin.__call__django/utils/deprecation.py:3098 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
AccountMiddleware.<locals>.middlewareallauth/account/middleware.py:348 ms20.5%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:558 ms20.5%
BaseHandler._get_responsedjango/core/handlers/base.py:1988 ms20.5%
csrf_exempt.<locals>._view_wrapperdjango/views/decorators/csrf.py:658 ms20.5%
jsonify_errors.<locals>.wrapped_viewapps/api/urls.py:378 ms20.5%
require_http_methods.<locals>.decorator.<locals>.innerdjango/views/decorators/http.py:648 ms20.5%
api_request.<locals>.decorator.<locals>.wrapped_viewapps/api/urls.py:73 touch_token(request.headers.get("Authorization"))5 ms12.3%
Atomic.__enter__django/db/transaction.py:2112 ms4.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms4.1%
BaseDatabaseWrapper.savepointdjango/db/backends/base/base.py:4002 ms4.1%
BaseDatabaseWrapper._savepointdjango/db/backends/base/base.py:3672 ms4.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms4.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms4.1%
CursorWrapper._executedjango/db/backends/utils.py:1032 ms4.1%
Cursor.executepsycopg/cursor.py:1132 ms4.1%
Connection.waitpsycopg/connection.py:4952 ms4.1%
BaseCursor._execute_genpsycopg/_cursor_base.py:2062 ms4.1%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:3122 ms4.1%
touch_tokenapps/api/urls.py:59 SecretTokens.objects.filter(pk__in=list(stale)).update(date_last_used=now)2 ms4.1%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms4.1%
QuerySet.filterdjango/db/models/query.py:15422 ms4.1%
QuerySet._filter_or_excludedjango/db/models/query.py:15602 ms4.1%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:15702 ms4.1%
Query.add_qdjango/db/models/sql/query.py:16712 ms4.1%
Query._add_qdjango/db/models/sql/query.py:17032 ms4.1%
Query.build_filterdjango/db/models/sql/query.py:16132 ms4.1%
Query.build_lookupdjango/db/models/sql/query.py:14252 ms4.1%
Atomic.__exit__django/db/transaction.py:2472 ms4.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms4.1%
BaseDatabaseWrapper.savepoint_commitdjango/db/backends/base/base.py:4312 ms4.1%
BaseDatabaseWrapper._savepoint_commitdjango/db/backends/base/base.py:3742 ms4.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms4.1%
BaseDatabaseWrapper.cursordjango/db/backends/base/base.py:3202 ms4.1%
BaseDatabaseWrapper._cursordjango/db/backends/base/base.py:2982 ms4.1%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:262 ms4.1%
DatabaseWrapper.create_cursordjango/db/backends/postgresql/base.py:4302 ms4.1%
api_request.<locals>.decorator.<locals>.wrapped_viewapps/api/urls.py:72 project = get_object_or_404(Project, secrettokens__token=request.headers.get("Authorization"))3 ms8.2%
get_object_or_404django/shortcuts.py:903 ms8.2%
QuerySet.getdjango/db/models/query.py:6252 ms4.1%
QuerySet.filterdjango/db/models/query.py:15422 ms4.1%
QuerySet._filter_or_excludedjango/db/models/query.py:15602 ms4.1%
QuerySet._filter_or_exclude_inplacedjango/db/models/query.py:15702 ms4.1%
Query.add_qdjango/db/models/sql/query.py:16712 ms4.1%
Query._add_qdjango/db/models/sql/query.py:17032 ms4.1%
Query.build_filterdjango/db/models/sql/query.py:15512 ms4.1%
QuerySet.getdjango/db/models/query.py:6352 ms4.1%
QuerySet.__len__django/db/models/query.py:3722 ms4.1%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms4.1%
ModelIterable.__iter__django/db/models/query.py:952 ms4.1%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms4.1%
CursorWrapper.executedjango/db/backends/utils.py:792 ms4.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms4.1%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms4.1%
Cursor.executepsycopg/cursor.py:1132 ms4.1%
Connection.waitpsycopg/connection.py:4952 ms4.1%
BaseHandler.get_responsedjango/core/handlers/base.py:1442 ms4.1%
log_responsedjango/utils/log.py:2802 ms4.1%
log_messagedjango/utils/log.py:2492 ms4.1%
Logger.warning<stdlib>/logging/__init__.py:15402 ms4.1%
Logger._log<stdlib>/logging/__init__.py:16732 ms4.1%
Logger.handle<stdlib>/logging/__init__.py:16892 ms4.1%
Logger.callHandlers<stdlib>/logging/__init__.py:17492 ms4.1%
Handler.handle<stdlib>/logging/__init__.py:10302 ms4.1%
StreamHandler.emit<stdlib>/logging/__init__.py:11572 ms4.1%
ProfileUploadTest.documentapps/api/tests.py:5012 ms4.1%
make_test_entryapps/projects/testing.py:169 return {2 ms4.1%
ProfileUploadTest.documentapps/api/tests.py:5112 ms4.1%
make_profile_documentapps/projects/testing.py:288 "id": run_id or uuid.uuid4().hex,2 ms4.1%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()2 ms4.1%
TestCase._fixture_teardowndjango/test/testcases.py:14942 ms4.1%
TestCase._should_check_constraintsdjango/test/testcases.py:15032 ms4.1%
DatabaseWrapper.is_usabledjango/db/backends/postgresql/base.py:4922 ms4.1%
Cursor.executepsycopg/cursor.py:1132 ms4.1%
Connection.waitpsycopg/connection.py:4952 ms4.1%
Estimated from 24 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
27 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
3 ms
apps/api/urls.py:73
touch_token(request.headers.get("Authorization"))
api_request.<locals>.decorator.<locals>.wrapped_view · Database
3 ms
apps/projects/testing.py:169
return {
make_test_entry · App code
2 ms
apps/api/urls.py:59
SecretTokens.objects.filter(pk__in=list(stale)).update(date_last_used=now)
touch_token · Database
2 ms
apps/projects/testing.py:288
"id": run_id or uuid.uuid4().hex,
make_profile_document · App code
2 ms

Fixtures

Exact setup time
_dj_autoclear_mailbox function 0.05 ms
_template_string_if_invalid_marker function 0.03 ms
_django_set_urlconf function 0.03 ms
_django_db_marker 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

22 queries · 5 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
39 ms
call _post_teardown
django/test/testcases.py:1240
2 ms

Reliability

15 results · 0 CI failures · 0 local failures

This test hasn't failed recently.

History

Latest 15 results, oldest first in the strip
When Environment Outcome Duration Commit
2 weeks ago CI github-actions:test passed 41 ms cb18ed3 main Profile
2 weeks, 4 days ago CI github-actions:test passed 46 ms 9bd5864 main Profile
2 weeks, 6 days ago CI github-actions:test passed 28 ms 19dac9b main Profile
3 weeks ago CI github-actions:test passed 61 ms e141198 main Profile
1 month ago CI github-actions:test passed 29 ms 46ec2aa main Profile
1 month ago CI github-actions:test passed 49 ms afde85b main Profile
1 month ago CI github-actions:test passed 35 ms fe29f9d main Profile
1 month ago CI github-actions:test passed 71 ms 044719a main Profile
1 month ago CI github-actions:test passed 31 ms b3fedae main Profile
1 month, 1 week ago CI github-actions:test passed 52 ms 43c4eda main Profile
1 month, 1 week ago CI github-actions:test passed 52 ms 9caa567 main Profile
1 month, 1 week ago CI github-actions:test passed 50 ms ec75501 main Profile
1 month, 1 week ago CI github-actions:test passed 58 ms d2c12e5 main Profile
1 month, 1 week ago CI github-actions:test passed 30 ms 0b902f6 main Profile
1 month, 1 week ago CI github-actions:test passed 49 ms 78a4357 main Profile