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

Stop mis-identifying unit_test config paths in dbt_project.yaml as unused #10312

Commits on Jun 14, 2024

  1. Add basic semantic layer fixture nodes to unit test manifest fixture

    We're doing this in preperation to a for a unit test which will be testing
    these nodes (as well as others) and thus we want them in the manifest.
    QMalcolm committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    58990aa View commit details
    Browse the repository at this point in the history
  2. Add WhereFilterInteresection to QueryParams of saved_query fixture

    In the previous commit, 58990aa, we added
    the `saved_query` fixture to the `manifest` fixture. This broke the test
    `tests/unit/parser/test_manifest.py::TestPartialParse::test_partial_parse_by_version`.
    It broke because the `Manifest.deepcopy` manifest basically dictifies things. When we were
    dictifying the `QueryParams` of the `saved_query` before, the `where` key was getting
    dropped because it was `None`. We'd then run into a runtime error on instantiation of the
    `QueryParams` because although `where` is declared as _optional_, we don't set a default
    value for it. And thus, kaboom :(
    
    We should probably provide a default value for `where`. However that is out of scope
    for this branch of work.
    QMalcolm committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    2e3229d View commit details
    Browse the repository at this point in the history
  3. Fix test_select_fqn to account for newly included semantic model

    In 58990aa we added a semantic model
    to the `manifest` fixture. This broke the test
    `tests/unit/graph/test_selector_methods.py::test_select_fqn` because in
    the test it selects nodes based on the string `*.*.*_model`. The newly
    added semantic model matches this, and thus needed to be added to the
    expected results.
    QMalcolm committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    c25fb92 View commit details
    Browse the repository at this point in the history
  4. Add unit tests for _warn_for_unused_resource_config_paths method

    Note: At this point the test when run with for a `unit_test` config
    taht should be considered used, fails. This is because it is not being
    properly identified as used.
    QMalcolm committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    fad3dd9 View commit details
    Browse the repository at this point in the history
  5. Include unit_tests in Manifest.get_resouce_fqns

    Because `unit_tests` weren't being included in calls to `Manifest.get_resource.fqns`,
    it always appeared to `_warn_for_unused_resource_config_paths` that there were no
    unit tests in the manifest. Because of this `_warn_for_unused_resource_config_paths` thought
    that _any_ `unit_test` config in `dbt_project.yaml` was unused.
    QMalcolm committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    ffd1272 View commit details
    Browse the repository at this point in the history