Skip to content

Fix flaky test_database_page test with deterministic ordering#2628

Merged
simonw merged 5 commits intomainfrom
claude/fix-flaky-database-test-u3GBO
Jan 24, 2026
Merged

Fix flaky test_database_page test with deterministic ordering#2628
simonw merged 5 commits intomainfrom
claude/fix-flaky-database-test-u3GBO

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Jan 22, 2026

  • Add ORDER BY to table_names() query in database.py
  • Sort foreign keys deterministically in get_all_foreign_keys()
  • Refactor test_database_page to use property-based assertions instead of
    500+ lines of hardcoded expected data
  • Run blacken-docs on plugin_hooks.rst

📚 Documentation preview 📚: https://datasette--2628.org.readthedocs.build/en/2628/

- Add ORDER BY to table_names() query in database.py
- Sort foreign keys deterministically in get_all_foreign_keys()
- Refactor test_database_page to use property-based assertions instead of
  500+ lines of hardcoded expected data
- Run blacken-docs on plugin_hooks.rst
The foreign keys are now sorted by (other_table, column, other_column),
so complex_foreign_keys comes before foreign_key_references alphabetically.
@simonw simonw force-pushed the claude/fix-flaky-database-test-u3GBO branch from 8d0a40d to ab9541c Compare January 22, 2026 15:04
The table_names() method now returns tables sorted alphabetically.
@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.23%. Comparing base (66d2a03) to head (3ae36f2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2628   +/-   ##
=======================================
  Coverage   90.23%   90.23%           
=======================================
  Files          51       51           
  Lines        7536     7539    +3     
=======================================
+ Hits         6800     6803    +3     
  Misses        736      736           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@simonw simonw merged commit 7915c46 into main Jan 24, 2026
39 checks passed
@simonw simonw deleted the claude/fix-flaky-database-test-u3GBO branch January 24, 2026 04:57
simonw added a commit that referenced this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants