flakytest.dev anze3db flakytest
All environments · last 30 days

Test suite performance

Suite wall time
30.31 s
avg over 9 profiled runs
Total test time
24.79 s
sum of test durations per run
Tests
253
in 1 environment
Failure rate
0.0%
0 of 2,915 results
Flaky tests
0

Suite wall time per run

Click a point to open the run

Where the time goes

Avg test time per run
CI github-actions:test
24.79 s
Database Test code Password hashing App code Factories Migrations Other (Libraries, DB schema, Templates, Imports, ...)

Slowest tests

All tests →
Test and why it's slow Avg Share of suite Runs
apps/api/tests.py::TestApiIndex::test_index
77% migrations · fixture django_db_setup (session scope) pytest_django/fixtures.py:198
3.50 s
14.1%
9
apps/projects/tests.py::SeedDemoCommandTest::test_seed_demo
64% database · test body apps/projects/tests.py:1145
1.83 s
7.4%
9
ft/tests.py::TestAccountSettings::test_change_password
96% password hashing · test body ft/tests.py:199
1.08 s
4.4%
9
apps/api/tests.py::ProfileUploadTest::test_missing_parts_mark_the_profile_incomplete
42% templates · test body apps/api/tests.py:830
435 ms
1.8%
9
apps/projects/tests.py::ProfilePagePaginationTest::test_slowest_tests_first_then_the_next_page
60% database · setUpClass django/test/testcases.py:1439
421 ms
1.7%
9
apps/orgs/tests.py::SignupTest::test_signing_up_creates_an_organization
69% password hashing · test body apps/orgs/tests.py:28
344 ms
1.4%
9
apps/projects/tests.py::ProjectPagesTest::test_configure_page
77% database · setUpClass django/test/testcases.py:1423
340 ms
1.4%
9
apps/api/tests.py::IngestStartEndpointTest::test_all_test_status_types
58% database · test body apps/api/tests.py:261
322 ms
1.3%
9
apps/orgs/tests.py::SuperuserTest::test_superusers_can_open_any_project_but_dont_list_them
77% password hashing · test body apps/orgs/tests.py:194
317 ms
1.3%
9
apps/api/tests.py::IngestStartEndpointTest::test_ingest_end_after_progress
46% database · test body apps/api/tests.py:239
303 ms
1.2%
9

Fix next

From the latest run per environment, by time saved
1

Run 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.

High Parallelism ci:github-actions:test
13.60 s per run
Fix: pip install pytest-xdist, then run pytest -n auto (add it to addopts, or only in CI). pytest-django creates a separate test database per worker automatically. Read the guide
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.

Documentation

2

Use plain static file storage in tests

Static file storage/manifest handling costs 12.7s.

High App code ci:github-actions:test
12.71 s per run
Fix: In test settings use STORAGES["staticfiles"] = {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"} so templates don't need a manifest. Read the guide
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
3

Disable django-debug-toolbar in tests

django-debug-toolbar is installed in the test settings and costs 7.8s.

High App code ci:github-actions:test
7.80 s per run
Fix: Only add debug_toolbar to INSTALLED_APPS and MIDDLEWARE when not testing (e.g. `if DEBUG and not TESTING:`). Read the guide
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

Documentation

4

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.

High Database ci:github-actions:test
3.18 s per run
Fix: For a PostgreSQL test server (Docker/CI service) start it with -c fsync=off -c synchronous_commit=off -c full_page_writes=off, and put its data directory on tmpfs; for MySQL use --innodb-flush-log-at-trx-commit=0 --skip-log-bin. Never on a server with data you need. Read the guide
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

Documentation

CI vs local

Tests that are much slower in CI, and why

Upload profiles from CI and from a developer machine to compare them.

Locally: FLAKYTEST_SECRET_TOKEN=… pytest --flakytest-profile

Failing and flaky tests

No failures in this window.

Environments

Every CI job and developer machine that reported in the last 30 days
Environment Profiled runs Sessions Avg wall time Peak memory Last seen
CI github-actions:test 9 12 30.31 s 183 MB 16 hours ago
CI github-actions 0 0 – – 2 years, 1 month ago