You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
If a test has a SetUp/TearDown convert these to fixtures
Housekeeping
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
intests/unit/test_infer_primary_key.py
is testing the functioninfer_primary_key
which lives incore/dbt/contracts/graph/nodes.py
. Thus for the test location to be easier to reason about it should live intests/unit/contracts/graph/test_nodes.py
Acceptance criteria
SetUp/TearDown
convert these to fixturesSuggested Tests
None. It's all tests already.
Impact to Other Teams
N/A
Will backports be required?
No
Context
No response
The text was updated successfully, but these errors were encountered: