Skip to content

Refactor: Replace flat_structure fixture's 55 static SQL files with tmp_path generation #355

@kami619

Description

@kami619

Summary

tests/fixtures/dbt_projects/flat_structure/ contains 55 nearly identical SQL files (model_1.sql through model_55.sql), each containing select N as id. These exist solely to test the "flat structure" detection threshold (>=50 files).

Suggestion

Generate these dynamically in a pytest fixture using tmp_path:

@pytest.fixture
def flat_structure_repo(tmp_path):
    models_dir = tmp_path / "models"
    models_dir.mkdir()
    for i in range(55):
        (models_dir / f"model_{i}.sql").write_text(f"select {i} as id")
    (tmp_path / "dbt_project.yml").write_text(
        "name: 'flat'\nconfig-version: 2\nprofile: 'default'\nmodel-paths: ['models']"
    )
    return Repository(path=tmp_path, ...)

This removes 55 files from the repo while keeping the same test coverage.

Found in

PR #334 — Feature/add dbt support

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions