Skip to content

test: consolidate functional test classes onto shared project fixtures - #767

Merged
axellpadilla merged 3 commits into
dbt-msft:masterfrom
axellpadilla:feat/optimize-tests
Jul 27, 2026
Merged

test: consolidate functional test classes onto shared project fixtures#767
axellpadilla merged 3 commits into
dbt-msft:masterfrom
axellpadilla:feat/optimize-tests

Conversation

@axellpadilla

@axellpadilla axellpadilla commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Many functional test classes each spun up their own dbt project fixture
    (schema create/parse/connect) even when testing independent models — that
    setup cost dominates wall-clock time far more than the SQL itself.
  • Merges classes with compatible fixtures (no project_config_update
    conflicts, no whole-project result-count assumptions) into one class per
    file/group, using explicit --models/--select per test so cases stay
    isolated. Classes with their own project_config_update or that depend on
    being the entire project are kept separate to avoid cross-test leakage.
  • No coverage or assertions changed; every comment/docstring preserved
    (verified via AST diff).
File Classes Time
test_query_options.py 27 → 4 49.6s → 21.5s (−57%)
test_index_config.py 13 → 4 49.2s → 39.7s (−19%)
test_transactions.py 10 → 3 8.5s → 6.3s (−26%)
test_full_refresh_build.py 8 → 1 28.5s → 23.4s (−18%)

Reviewed but left alone (structural blockers, not effort): files subclassing
upstream dbt-tests-adapter base classes (test_utils.py, test_functions.py,
test_hooks.py, test_empty.py), and files where every class hardcodes the same
resource name (test_constraints.py, test_snapshot_configs.py,
test_materialize_change.py, test_test_with.py).

Test plan

  • Full tests/functional suite (pytest -n auto): 320 passed,
    48 skipped, 2 xfailed in 5m27s — no regressions
  • Each touched file verified individually against its pre-change baseline

…xtures

Continues the class-merging optimization: query_options, index_config,
transactions, and full_refresh_build now share one project/schema per
file (or per isolation-requiring group) instead of one per test class,
since project setup dominates runtime more than the SQL itself. Also
restores two clarifying comments that were dropped in the earlier
table_refresh_method consolidation.

Coverage and assertions are unchanged; classes with project_config_update
or whole-project result-count assumptions were kept isolated to avoid
cross-test leakage.
@axellpadilla
axellpadilla enabled auto-merge July 27, 2026 03:51
@axellpadilla
axellpadilla disabled auto-merge July 27, 2026 03:52
@axellpadilla
axellpadilla merged commit d36d1bf into dbt-msft:master Jul 27, 2026
15 checks passed
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.

1 participant