-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Parameterized testing examples utilizing happy path fixture #10480
Conversation
The commit c783a86 removed the snapshot file from the happy path fixture. This was done because the snapshot was breaking the tests we were adding, `test_run_commands`. However this broke `test_ls` in `test_list.py`. In order to move forward, we need everything to be working. Maybe the idea was to delete the `test_list.py` file, however that is not noted anywhere, and was not done. Thus this commit ensures that test is not broken nor or new tests.
… is failing (if any)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10480 +/- ##
=======================================
Coverage 88.84% 88.84%
=======================================
Files 180 180
Lines 22717 22717
=======================================
+ Hits 20182 20183 +1
+ Misses 2535 2534 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me! I will leave the approval to whoever haven't touched this file.
Seems to be database related. Ideally snapshots should work in these tests. It's a bad sign that they don't. That | ||
may have more to do with our fixture setup than the source code though. | ||
|
||
Note: that the `happy_path_fixture_files` are a _class_ based fixture. Thus although this fixture _modifies_ the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this comment!
"macro", | ||
"exposure", | ||
"group", | ||
"unit_test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unit_test is excluded here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current happy_path_project
fixture doesn't have any unit tests. Thus when the test is run against the unit_test
resource type, the following failure is the result.
___________________________________________________ TestSelectResourceType.test_select_by_resource_type[unit_test] ___________________________________________________
self = <test_commands.TestSelectResourceType object at 0x1233d1ed0>, resource_type = 'unit_test'
happy_path_project = <dbt.tests.fixtures.project.TestProjInfo object at 0x1233ab0d0>, runner = <dbt.cli.main.dbtRunner object at 0x12742ee90>
catcher = EventCatcher(event_to_catch=<class 'dbt.events.types.NoNodesSelected'>, caught_events=[info {
name: "NoNodesSelected" seconds: 1723041301
nanos: 398960000
}
}
data {
}
], predicate=<function EventCatcher.<lambda> at 0x1233c4790>)
@pytest.mark.parametrize("resource_type", resource_types)
def test_select_by_resource_type(
self,
resource_type: str,
happy_path_project,
runner: dbtRunner,
catcher: EventCatcher,
) -> None:
runner.invoke(["list", "--select", f"resource_type:{resource_type}"])
> assert len(catcher.caught_events) == 0
E assert 1 == 0
E + where 1 = len([info {\n name: "NoNodesSelected"\n code: "Q038"\n msg: "No nodes selected!"\n level: "warn"\n invocation_id: "1658b1b...-9b5a0b185114"\n pid: 59592\n thread: "MainThread"\n ts {\n seconds: 1723041301\n nanos: 398960000\n }\n}\ndata {\n}\n])
E + where [info {\n name: "NoNodesSelected"\n code: "Q038"\n msg: "No nodes selected!"\n level: "warn"\n invocation_id: "1658b1b...-9b5a0b185114"\n pid: 59592\n thread: "MainThread"\n ts {\n seconds: 1723041301\n nanos: 398960000\n }\n}\ndata {\n}\n] = EventCatcher(event_to_catch=<class 'dbt.events.types.NoNodesSelected'>, caught_events=[info {\n name: "NoNodesSelected" seconds: 1723041301\n nanos: 398960000\n }\n}\ndata {\n}\n], predicate=<function EventCatcher.<lambda> at 0x1233c4790>).caught_events
/Users/quigleymalcolm/Developer/dbt-labs/dbt-core/tests/functional/list/test_commands.py:105: AssertionError
Resolves #10287
Problem
We lacked broad parameterized testing examples using the happy path fixture.
Solution
Make some parameterized happy path testing examples.
Checklist