Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Robust Testing] Reorganize tests to match source code #9961

Closed
1 task done
Tracked by #9649
QMalcolm opened this issue Apr 17, 2024 · 1 comment
Closed
1 task done
Tracked by #9649

[Robust Testing] Reorganize tests to match source code #9961

QMalcolm opened this issue Apr 17, 2024 · 1 comment
Assignees
Labels
tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality

Comments

@QMalcolm
Copy link
Contributor

QMalcolm commented Apr 17, 2024

Housekeeping

  • I am a maintainer of dbt-core

Short description

THIS IS A MEGA ISSUE INTENDED TO BE WORKED ON BY MULTIPLE PEOPLE DURING A TIME BOUND

Our unit tests are currently in files that don’t match the modules they are testing and are in a flat directory structure. This isn’t great because whenever we need to make a unit test, it’s hard to know if there is already a file the tests should go in and whether there are any similar tests to use as a model for the new tests.

Luckily there is a solution! Unit tests should be testing a specific function or class. As such it makes sense to reorganize the tests to live on paths and files that mirror where they live in the source code. For instance the test test_primary_key_model_constraint in tests/unit/test_infer_primary_key.py is testing the function infer_primary_key which lives in core/dbt/contracts/graph/nodes.py. Thus for the test location to be easier to reason about it should live in tests/unit/contracts/graph/test_nodes.py

Acceptance criteria

Suggested Tests

None. It's all tests already.

Impact to Other Teams

N/A

Will backports be required?

No

Context

No response

@QMalcolm QMalcolm added the tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality label Apr 17, 2024
@emmyoop emmyoop mentioned this issue Apr 17, 2024
5 tasks
@QMalcolm QMalcolm changed the title Robust Testing: Reorganize tests to match [Robust Testing] Reorganize tests to match Apr 18, 2024
@QMalcolm QMalcolm changed the title [Robust Testing] Reorganize tests to match [Robust Testing] Reorganize tests to match source code Apr 18, 2024
@ChenyuLInx
Copy link
Contributor

Done with #10191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality
Projects
None yet
Development

No branches or pull requests

2 participants