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

Enable using the list command on unit tests #9480

Merged
merged 8 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
elif node.resource_type == NodeType.Unit:
assert isinstance(node, UnitTestDefinition)
unit_test_selector = ".".join([node.package_name, node.name])
MichelleArk marked this conversation as resolved.
Show resolved Hide resolved
if node.version:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a direct comparison to None to ensure version=0 is handled correctly.

Copy link
Contributor

@MichelleArk MichelleArk Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth implementing a property on UnitTestDefinition.. maybe versioned_name? and consolidate this logic here + in formatting in test.py: https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/task/test.py#L87-L88

your call!

unit_test_selector += f"_v{node.version}"

Check warning on line 117 in core/dbt/task/list.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/list.py#L117

Added line #L117 was not covered by tests
yield f"unit_test:{unit_test_selector}"
else:
# everything else is from `fqn`
Expand Down
Loading