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

ProfileUploadTest::test_invalid_part

First seen 3 weeks ago in 78a4357
CI github-actions:test 12 runs
Average
47 ms
median 49 ms
max 71 ms
Phases
Setup 0.67 ms Call 46 ms Teardown 0.16 ms
Categories
Database 12 ms App code 2 ms Test code 0.19 ms Other (Libraries, Serialization, Unsampled, Logging, ...) 33 ms

22 database queries per run

Needs 8 KB of memory (max 64 KB)

Duration per run

Where the time goes

Latest run in ci:github-actions:test, 16 hours ago · open run
Show pytest frames
call60 ms98.5%
ProfileUploadTest.test_invalid_partapps/api/tests.py:891 response = self.upload(self.document() | {"part": part})59 ms96.2%
ProfileUploadTest.uploadapps/api/tests.py:487 response = self.client.post(59 ms96.2%
Client.postdjango/test/client.py:115359 ms96.2%
RequestFactory.postdjango/test/client.py:49959 ms96.2%
RequestFactory.genericdjango/test/client.py:67159 ms96.2%
Client.requestdjango/test/client.py:108259 ms96.2%
ClientHandler.__call__django/test/client.py:17333 ms53.7%
BaseHandler.load_middlewaredjango/core/handlers/base.py:6233 ms53.7%
WhiteNoiseMiddleware.__init__whitenoise/middleware.py:10433 ms53.7%
WhiteNoise.add_fileswhitenoise/base.py:10833 ms53.7%
WhiteNoise.update_files_dictionarywhitenoise/base.py:12033 ms53.7%
WhiteNoise.add_file_to_dictionarywhitenoise/base.py:13133 ms53.7%
WhiteNoise.get_static_filewhitenoise/base.py:20825 ms40.3%
StaticFile.__init__whitenoise/responders.py:768 ms13.4%
StaticFile.get_not_modified_responsewhitenoise/responders.py:1885 ms9.0%
Headers.__contains__<stdlib>/wsgiref/headers.py:874 ms6.7%
Headers.get<stdlib>/wsgiref/headers.py:1063 ms4.5%
Headers.get<stdlib>/wsgiref/headers.py:1081 ms2.2%
StaticFile.get_not_modified_responsewhitenoise/responders.py:1893 ms4.5%
Headers.__getitem__<stdlib>/wsgiref/headers.py:833 ms4.5%
Headers.get<stdlib>/wsgiref/headers.py:1063 ms4.5%
StaticFile.__init__whitenoise/responders.py:775 ms9.0%
StaticFile.get_alternativeswhitenoise/responders.py:2003 ms4.5%
__init____init__:-11 ms2.2%
Headers.__init__<stdlib>/wsgiref/headers.py:431 ms2.2%
StaticFile.get_alternativeswhitenoise/responders.py:2011 ms2.2%
StaticFile.get_alternativeswhitenoise/responders.py:2041 ms2.2%
StaticFile.__init__whitenoise/responders.py:735 ms9.0%
StaticFile.get_headerswhitenoise/responders.py:1763 ms4.5%
formatdate<stdlib>/email/utils.py:2663 ms4.5%
format_datetime<stdlib>/email/utils.py:2841 ms2.2%
StaticFile.get_headerswhitenoise/responders.py:1811 ms2.2%
StaticFile.get_headerswhitenoise/responders.py:1781 ms2.2%
parsedate<stdlib>/email/_parseaddr.py:1851 ms2.2%
StaticFile.__init__whitenoise/responders.py:721 ms2.2%
StaticFile.get_file_statswhitenoise/responders.py:1571 ms2.2%
StaticFile.__init__whitenoise/responders.py:741 ms2.2%
Headers.__getitem__<stdlib>/wsgiref/headers.py:831 ms2.2%
WhiteNoise.get_static_filewhitenoise/base.py:2035 ms9.0%
WhiteNoise.add_cache_headerswhitenoise/base.py:2243 ms4.5%
WhiteNoiseMiddleware.immutable_file_testwhitenoise/middleware.py:1763 ms4.5%
WhiteNoiseMiddleware.get_static_urlwhitenoise/middleware.py:1973 ms4.5%
URLMixin.urldebug_toolbar/panels/staticfiles.py:203 ms4.5%
HashedFilesMixin.urldjango/contrib/staticfiles/storage.py:2051 ms2.2%
HashedFilesMixin._urldjango/contrib/staticfiles/storage.py:1841 ms2.2%
WhiteNoise.get_static_filewhitenoise/base.py:2021 ms2.2%
ClientHandler.__call__django/test/client.py:18626 ms42.5%
BaseHandler.get_responsedjango/core/handlers/base.py:14125 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
DebugToolbarMiddleware.__call__debug_toolbar/middleware.py:13025 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
MiddlewareMixin.__call__django/utils/deprecation.py:30925 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
WhiteNoiseMiddleware.__call__whitenoise/middleware.py:12325 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
MiddlewareMixin.__call__django/utils/deprecation.py:30925 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
MiddlewareMixin.__call__django/utils/deprecation.py:30925 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
MiddlewareMixin.__call__django/utils/deprecation.py:30925 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
MiddlewareMixin.__call__django/utils/deprecation.py:30925 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
MiddlewareMixin.__call__django/utils/deprecation.py:30925 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
MiddlewareMixin.__call__django/utils/deprecation.py:30925 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
AccountMiddleware.<locals>.middlewareallauth/account/middleware.py:3425 ms40.3%
convert_exception_to_response.<locals>.innerdjango/core/handlers/exception.py:5525 ms40.3%
BaseHandler._get_responsedjango/core/handlers/base.py:19825 ms40.3%
csrf_exempt.<locals>._view_wrapperdjango/views/decorators/csrf.py:6525 ms40.3%
jsonify_errors.<locals>.wrapped_viewapps/api/urls.py:3725 ms40.3%
require_http_methods.<locals>.decorator.<locals>.innerdjango/views/decorators/http.py:6425 ms40.3%
api_request.<locals>.decorator.<locals>.wrapped_viewapps/api/urls.py:7515 ms24.6%
profile_uploadapps/api/urls.py:13714 ms22.4%
parse_documentapps/projects/profiles.py:8014 ms22.4%
loadsapps/projects/profiles.py:118 document = json.loads(data)11 ms17.9%
loads<stdlib>/json/__init__.py:37111 ms17.9%
JSONDecoder.decode<stdlib>/json/decoder.py:35811 ms17.9%
JSONDecoder.raw_decode<stdlib>/json/decoder.py:37411 ms17.9%
loadsapps/projects/profiles.py:119 return storable(document) if UNSTORABLE_ESCAPE.search(data) else document3 ms4.5%
profile_uploadapps/api/urls.py:139 return JsonResponse({"message": str(e)}, status=e.status)1 ms2.2%
api_request.<locals>.decorator.<locals>.wrapped_viewapps/api/urls.py:73 touch_token(request.headers.get("Authorization"))10 ms15.7%
touch_tokenapps/api/urls.py:59 SecretTokens.objects.filter(pk__in=list(stale)).update(date_last_used=now)7 ms11.2%
QuerySet.updatedjango/db/models/query.py:13003 ms4.5%
SQLUpdateCompiler.execute_sqldjango/db/models/sql/compiler.py:21113 ms4.5%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16241 ms2.2%
CursorWrapper.executedjango/db/backends/utils.py:791 ms2.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms2.2%
CursorWrapper._executedjango/db/backends/utils.py:1051 ms2.2%
Cursor.executepsycopg/cursor.py:1131 ms2.2%
Connection.waitpsycopg/connection.py:4951 ms2.2%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16111 ms2.2%
SQLUpdateCompiler.as_sqldjango/db/models/sql/compiler.py:20651 ms2.2%
QuerySet.updatedjango/db/models/query.py:13021 ms2.2%
QuerySet.__iter__django/db/models/query.py:3901 ms2.2%
QuerySet._fetch_alldjango/db/models/query.py:20001 ms2.2%
FlatValuesListIterable.__iter__django/db/models/query.py:2771 ms2.2%
SQLCompiler.results_iterdjango/db/models/sql/compiler.py:15731 ms2.2%
Atomic.__exit__django/db/transaction.py:2473 ms4.5%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:263 ms4.5%
BaseDatabaseWrapper.savepoint_commitdjango/db/backends/base/base.py:4313 ms4.5%
BaseDatabaseWrapper._savepoint_commitdjango/db/backends/base/base.py:3753 ms4.5%
CursorWrapper.executedjango/db/backends/utils.py:793 ms4.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:923 ms4.5%
CursorWrapper._executedjango/db/backends/utils.py:1033 ms4.5%
Cursor.executepsycopg/cursor.py:1133 ms4.5%
Connection.waitpsycopg/connection.py:4953 ms4.5%
BaseCursor._execute_genpsycopg/_cursor_base.py:2063 ms4.5%
BaseCursor._maybe_prepare_genpsycopg/_cursor_base.py:2863 ms4.5%
ClientCursorMixin._execute_sendpsycopg/client_cursor.py:783 ms4.5%
BaseHandler.get_responsedjango/core/handlers/base.py:1441 ms2.2%
log_responsedjango/utils/log.py:2801 ms2.2%
log_messagedjango/utils/log.py:2491 ms2.2%
Logger.warning<stdlib>/logging/__init__.py:15401 ms2.2%
Logger._log<stdlib>/logging/__init__.py:16731 ms2.2%
Logger.handle<stdlib>/logging/__init__.py:16891 ms2.2%
Logger.callHandlers<stdlib>/logging/__init__.py:17491 ms2.2%
Handler.handle<stdlib>/logging/__init__.py:10301 ms2.2%
StreamHandler.emit<stdlib>/logging/__init__.py:11571 ms2.2%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()1 ms2.2%
TestCase._fixture_teardowndjango/test/testcases.py:14951 ms2.2%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4841 ms2.2%
CursorWrapper.executedjango/db/backends/utils.py:791 ms2.2%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:921 ms2.2%
CursorWrapper._executedjango/db/backends/utils.py:1031 ms2.2%
Cursor.executepsycopg/cursor.py:1131 ms2.2%
Connection.waitpsycopg/connection.py:4951 ms2.2%
Estimated from 44 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
34 ms
apps/projects/profiles.py:118
document = json.loads(data)
loads · Serialization
11 ms
apps/api/urls.py:59
SecretTokens.objects.filter(pk__in=list(stale)).update(date_last_used=now)
touch_token · Database
7 ms
apps/api/urls.py:73
touch_token(request.headers.get("Authorization"))
api_request.<locals>.decorator.<locals>.wrapped_view · Database
3 ms
apps/projects/profiles.py:119
return storable(document) if UNSTORABLE_ESCAPE.search(data) else document
loads · App code
3 ms
apps/api/urls.py:139
return JsonResponse({"message": str(e)}, status=e.status)
profile_upload · App code
1 ms

Fixtures

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

Database

22 queries · 6 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
59 ms
call _post_teardown
django/test/testcases.py:1240
1 ms

Reliability

12 results · 0 CI failures · 0 local failures

This test hasn't failed recently.

History

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