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

unit test config #8565

Merged
merged 10 commits into from
Sep 12, 2023
Merged

unit test config #8565

merged 10 commits into from
Sep 12, 2023

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Sep 6, 2023

resolves #8294
docs dbt-labs/docs.getdbt.com/#

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

@cla-bot cla-bot bot added the cla:yes label Sep 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Patch coverage: 91.93% and project coverage change: +10.63% 🎉

Comparison is base (1e64f94) 76.09% compared to head (90908db) 86.72%.
Report is 17 commits behind head on unit_testing_feature_branch.

Additional details and impacted files
@@                       Coverage Diff                        @@
##           unit_testing_feature_branch    #8565       +/-   ##
================================================================
+ Coverage                        76.09%   86.72%   +10.63%     
================================================================
  Files                              176      176               
  Lines                            25962    26002       +40     
================================================================
+ Hits                             19755    22551     +2796     
+ Misses                            6207     3451     -2756     
Flag Coverage Δ
integration 83.62% <90.32%> (+7.53%) ⬆️
unit 64.98% <91.93%> (?)

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

Files Changed Coverage Δ
core/dbt/config/runtime.py 96.23% <ø> (+3.22%) ⬆️
core/dbt/contracts/graph/nodes.py 96.01% <66.66%> (+7.76%) ⬆️
core/dbt/context/context_config.py 93.84% <75.00%> (+8.50%) ⬆️
core/dbt/parser/unit_tests.py 92.92% <95.34%> (+3.77%) ⬆️
core/dbt/config/project.py 97.40% <100.00%> (+5.27%) ⬆️
core/dbt/context/providers.py 89.52% <100.00%> (+7.89%) ⬆️
core/dbt/contracts/graph/model_config.py 92.20% <100.00%> (+6.33%) ⬆️
core/dbt/contracts/graph/unparsed.py 93.69% <100.00%> (+2.90%) ⬆️
core/dbt/contracts/project.py 97.19% <100.00%> (+2.93%) ⬆️

... and 109 files with indirect coverage changes

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

@MichelleArk MichelleArk added the user docs [docs.getdbt.com] Needs better documentation label Sep 7, 2023
@MichelleArk MichelleArk changed the title first pass: unit test config unit test config Sep 7, 2023
@MichelleArk
Copy link
Contributor Author

MichelleArk commented Sep 11, 2023

I'm seeing the same mypy failure on the unit_testing_feature_branch branch: https://github.com/dbt-labs/dbt-core/actions/runs/6111537160/job/16586993751?pr=8411

core/dbt/context/providers.py:1507: error: Argument 1 to "contextmember" has incompatible type "Callable[[UnitTestContext, str, Optional[str]], str]"; expected "Optional[str]"  [arg-type]

@gshank - any idea what the cause is? I think we could review this PR independently and look to resolve the mypy issue in a follow-up

@MichelleArk MichelleArk marked this pull request as ready for review September 11, 2023 16:09
@MichelleArk MichelleArk requested a review from a team as a code owner September 11, 2023 16:09
@gshank
Copy link
Contributor

gshank commented Sep 11, 2023

That mypy error for contextmember was also seen in a mypy pr that Quigley did. Let me merge main into the feature branch...

@gshank
Copy link
Contributor

gshank commented Sep 11, 2023

Oh, I think '@contextmember' needs to be changed to '@contextmember()'

Copy link
Contributor

@gshank gshank left a comment

Choose a reason for hiding this comment

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

Code looks good. I suspect we'd get schema changes if we ran the script to build it though. We don't have any artifact tests for unit tests, which is why there are no test failures.

@MichelleArk MichelleArk requested a review from a team as a code owner September 11, 2023 22:06
@MichelleArk MichelleArk requested review from jzhu13 and removed request for a team September 11, 2023 22:06
@MichelleArk
Copy link
Contributor Author

I suspect we'd get schema changes if we ran the script to build it though.

good point! I updated manifest/v11.json in this commit so we can keep track of where the changes were necessary but won't backfill the artifact tests as this PR is already getting pretty big.

@MichelleArk
Copy link
Contributor Author

@dbt-labs/cloud-artifacts - these changes going onto a feature branch so don't need review quite yet as they will not be released until the feature branch is merged (which will tag the CA team for review at that point)

@MichelleArk MichelleArk merged commit 12342ca into unit_testing_feature_branch Sep 12, 2023
48 checks passed
@MichelleArk MichelleArk deleted the unit-test-config branch September 12, 2023 09:54
@FishtownBuildBot
Copy link
Collaborator

Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#4062

gshank added a commit that referenced this pull request Jan 16, 2024
* Initial implementation of unit testing (from pr #2911)

Co-authored-by: Michelle Ark <[email protected]>

* 8295 unit testing artifacts (#8477)

* unit test config: tags & meta (#8565)

* Add additional functional test for unit testing selection, artifacts, etc (#8639)

* Enable inline csv format in unit testing (#8743)

* Support unit testing incremental models (#8891)

* update unit test key: unit -> unit-tests (#8988)


* convert to use unit test name at top level key (#8966)

* csv file fixtures (#9044)

* Unit test support for `state:modified` and `--defer` (#9032)

Co-authored-by: Michelle Ark <[email protected]>

* Allow use of sources as unit testing inputs (#9059)

* Use daff for diff formatting in unit testing (#8984)

* Fix #8652: Use seed file from disk for unit testing if rows not specified in YAML config (#9064)

Co-authored-by: Michelle Ark <[email protected]>
Fix #8652: Use seed value if rows not specified

* Move unit testing to test and build commands (#9108)

* Enable unit testing in non-root packages (#9184)

* convert test to data_test (#9201)

* Make fixtures files full-fledged members of manifest and enable partial parsing (#9225)

* In build command run unit tests before models (#9273)

---------

Co-authored-by: Michelle Ark <[email protected]>
Co-authored-by: Michelle Ark <[email protected]>
Co-authored-by: Emily Rockman <[email protected]>
Co-authored-by: Jeremy Cohen <[email protected]>
Co-authored-by: Kshitij Aranke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants