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

Create a standard way to check events being fired in Unittest #9947

Closed
Tracked by #9649
ChenyuLInx opened this issue Apr 15, 2024 · 3 comments · Fixed by #10153
Closed
Tracked by #9649

Create a standard way to check events being fired in Unittest #9947

ChenyuLInx opened this issue Apr 15, 2024 · 3 comments · Fixed by #10153
Assignees

Comments

@ChenyuLInx
Copy link
Contributor

ChenyuLInx commented Apr 15, 2024

In dbt-core, we now use an event manager to handle logs. In unit tests, we want to check whether under certain conditions, dbt-core will emit certain type of logs. We have been doing this a lot in functional tests by using the run_and_capture function. In unittest, we should mock the event manager so we can check what fire_event has been called with.
AC:

  • we have a standard way of checking events in unit test.
  • a unit test using the new way to check events being fired.
@ChenyuLInx ChenyuLInx changed the title Mock event manager Create a standard way to mock Logger in Unittest Apr 15, 2024
@ChenyuLInx ChenyuLInx changed the title Create a standard way to mock Logger in Unittest Create a standard way to check events being fired in Unittest Apr 15, 2024
@ChenyuLInx
Copy link
Contributor Author

mock fire_event/ event_manager(depending on which way it is easier to mock).

@ChenyuLInx
Copy link
Contributor Author

@ChenyuLInx link one test that we want to modify

@ChenyuLInx
Copy link
Contributor Author

https://github.com/dbt-labs/dbt-core/pull/10009/files#r1575498113 Something related to this ticket. We should modify this test when proper mocking for logger is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants