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

test adapter pre hooks for unit testing #10273

Closed

Conversation

MichelleArk
Copy link
Contributor

resolves #

Problem

Solution

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@cla-bot cla-bot bot added the cla:yes label Jun 7, 2024
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.67%. Comparing base (ef67cff) to head (52e2e85).
Report is 5 commits behind head on mcknight/10198.

Additional details and impacted files
@@                Coverage Diff                 @@
##           mcknight/10198   #10273      +/-   ##
==================================================
- Coverage           88.69%   88.67%   -0.02%     
==================================================
  Files                 180      180              
  Lines               22520    22479      -41     
==================================================
- Hits                19973    19934      -39     
+ Misses               2547     2545       -2     
Flag Coverage Δ
integration 85.93% <ø> (-0.02%) ⬇️
unit 63.24% <ø> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mock_pre_model_hook = mock.Mock()
mock_pre_model_hook.side_effect = CompilationError("exception from adapter.pre_model_hook")
with mock.patch.object(type(project.adapter), "pre_model_hook", mock_pre_model_hook):
run_dbt(["test", "--select", "test_name:test_my_model"], expect_pass=False)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably want to use capture_and_run_dbt here and inspect the logs instead

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

Successfully merging this pull request may close these issues.

1 participant