Test suite performance
Suite wall time per run
Click a point to open the runWhere the time goes
Avg test time per runSlowest tests
All tests →Most memory
All tests by memory →Fix next
From the latest run per environment, by time savedRun tests in parallel on all 2 CPUs
Tests run one at a time: 27.2s of test time on a 2-CPU machine. With pytest-xdist this could take about 13.6s.
Details
Tests must not share state: files in fixed paths, ports, a shared database without per-worker names, or module globals. Run with -p randomly first to shake out order dependencies.
Use plain static file storage in tests
Static file storage/manifest handling costs 12.7s.
Details
Where:
- apps/api/tests.py:487 ProfileUploadTest.upload · 704 ms
- apps/mcp/tests.py:67 McpTest.post · 559 ms
- ft/tests.py:204 TestAccountSettings.test_change_password · 479 ms
- apps/guides/content.py:112 render · 455 ms
- apps/orgs/tests.py:28 SignupTest.test_signing_up_creates_an_organization · 313 ms
- apps/api/tests.py:98 IngestStartEndpointTest.ingest_start · 312 ms
- ft/tests.py:160 TestAccountPages.test_signup · 252 ms
- ft/tests.py:199 TestAccountSettings.test_change_password · 252 ms
- apps/projects/urls.py:498 project_profile · 188 ms
- apps/orgs/views.py:33 org_shell · 180 ms
Most affected tests:
- ft/tests.py::TestAccountSettings::test_change_password
- apps/api/tests.py::ProfileUploadTest::test_missing_parts_mark_the_profile_incomplete
- apps/orgs/tests.py::SignupTest::test_signing_up_creates_an_organization
- ft/tests.py::TestAccountPages::test_signup
- apps/projects/tests.py::ProjectPagesTest::test_dashboard_filters
- apps/api/tests.py::IngestStartEndpointTest::test_ingest_end_after_progress
- apps/api/tests.py::TestApiIndex::test_index
- apps/projects/tests.py::ProjectRunPage::test_project_with_runs_no_tests
Disable django-debug-toolbar in tests
django-debug-toolbar is installed in the test settings and costs 7.8s.
Details
Where:
- ft/tests.py:204 TestAccountSettings.test_change_password · 479 ms
- apps/guides/content.py:112 render · 455 ms
- apps/orgs/tests.py:28 SignupTest.test_signing_up_creates_an_organization · 302 ms
- ft/tests.py:160 TestAccountPages.test_signup · 252 ms
- ft/tests.py:199 TestAccountSettings.test_change_password · 252 ms
- apps/projects/urls.py:498 project_profile · 188 ms
- apps/orgs/views.py:33 org_shell · 180 ms
- apps/projects/models.py:18 get_or_create_numbered · 163 ms
- apps/projects/urls.py:49 find_project · 158 ms
- apps/api/urls.py:59 touch_token · 152 ms
Most affected tests:
- ft/tests.py::TestAccountSettings::test_change_password
- apps/api/tests.py::ProfileUploadTest::test_missing_parts_mark_the_profile_incomplete
- apps/orgs/tests.py::SignupTest::test_signing_up_creates_an_organization
- apps/projects/tests.py::ProjectPagesTest::test_dashboard_filters
- ft/tests.py::TestAccountPages::test_signup
- apps/api/tests.py::TestApiIndex::test_index
- apps/projects/tests.py::ProfilePagePaginationTest::test_slowest_tests_first_then_the_next_page
- apps/guides/tests.py::TestGuidePages::test_every_guide_renders
Make the test database server skip durability work
Tests spend 15.9s (59%) in the database. Test databases don't need to survive a crash, so the server can skip flushing to disk.
Details
Only affects crash safety of the throwaway test server; query behaviour is identical.
Where:
- apps/projects/models.py:466 Profile.save · 330 ms
- apps/projects/profiles.py:334 write_snapshots · 197 ms
- apps/api/tests.py:76 IngestStartEndpointTest.join_workers · 183 ms
- apps/projects/environments.py:63 get_or_create_environment · 177 ms
- apps/projects/tests.py:954 ProjectPagesTest.setUp · 169 ms
- apps/projects/models.py:18 get_or_create_numbered · 168 ms
- apps/orgs/views.py:33 org_shell · 167 ms
- apps/projects/urls.py:49 find_project · 158 ms
- apps/projects/profiles.py:479 write_perfs · 153 ms
- apps/api/urls.py:59 touch_token · 150 ms
Most affected tests:
- apps/api/tests.py::TestApiIndex::test_index
- apps/projects/tests.py::SeedDemoCommandTest::test_seed_demo
- apps/projects/tests.py::ProjectPagesTest::test_configure_page
- apps/projects/tests.py::ProjectPagesTest::test_dashboard_filters
- apps/api/tests.py::IngestStartEndpointTest::test_ingest_start_progress_end
- apps/api/tests.py::IngestStartEndpointTest::test_ingest_progress_before_start
- apps/api/tests.py::IngestStartEndpointTest::test_all_test_status_types
- apps/projects/tests.py::ProfilePagePaginationTest::test_slowest_tests_first_then_the_next_page
CI vs local
Tests that are much slower in CI, and whyUpload profiles from CI and from a developer machine to compare them.
Locally: FLAKYTEST_SECRET_TOKEN=… pytest --flakytest-profile
Failing and flaky tests
Environments
Every CI job and developer machine that reported in the last 30 days| Environment | Profiled runs | Avg wall time |
|---|---|---|
| CI github-actions:test | 9 | 30.31 s |
| CI github-actions | 0 | – |