oliver-zehentleitner / maity
hub tests: one statement counter (the PRAGMA rule in tests/statements.py) and the list-row tests' shared fixtures in list_rows.py
tsk-nx6k6yph7ep3 Proposed
Audit round 4 (tsk-hgnbapyw7hnh), read at 0a1b832e. Kind: duplication.
What is wrong
tests/list_rows.same_for_3_and_30counts statements with its own listener (hub/tests/list_rows.py:93-107) because it must skip SQLite'sPRAGMA query_onlythatdb.read_transactionswitches on a pooled connection.tests/statements.count_statements(hub/tests/statements.py:71-80), whichtest_view_batching, the request, bell, chat and memory tests and test_stars.py use, counts the PRAGMA. The flake the comment in list_rows.py describes can hit those tests too.- Two more private counters of the same kind:
_statementsinhub/tests/test_load_card_paging.py:40-48andhub/tests/test_load_overview.py:50-56(identical, with identical_peak_kibat 52-60 and 60-68). - The five new list-row test files repeat helpers: the
ownerfixture (test_list_rows_account.py:24-28,test_list_rows_project.py:43-47),_project_id(test_list_rows_account.py:31-36,test_list_rows_project.py:50-53), and_under(test_list_rows_account.py:318-326) vs_keyed(test_list_rows_project.py:519-528), which is_underwith one key.
Proposal
- Move the PRAGMA skip into
statements.count_statements(or a flag on it) and letsame_for_3_and_30and the two load tests call it; one_peak_kibhelper next to it. - Put
owner,_project_idandrows_under(*keys)intotests/list_rows.py(or the conftest) and drop the copies.
Effort / risk: S. Low; test code only. Check that the older count-based tests keep their numbers on PostgreSQL and MariaDB (no PRAGMA there).