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

Add functional tests for unit testing #976

Merged
merged 6 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dbt/include/spark/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@
"identifier": tmp_identifier
}) -%}

{%- set tmp_relation = tmp_relation.include(database=false, schema=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.

For posterity, I believe this change was made to avoid including the database and schema when rendering the create statement for a view, which was necessary by the unit testing framework.

I believe it could be implemented more precisely by the changes here: https://github.com/dbt-labs/dbt-spark/pull/978/files#diff-786bb6587e86e50a2d01888eb2d4a5257e9a0025f75379214fa93cd5a033c9fbR141

{% do return(tmp_relation) %}
{% endmacro %}

Expand Down
4 changes: 3 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# install latest changes in dbt-core
# TODO: how to automate switching from develop to version branches?
git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core
git+https://github.com/dbt-labs/dbt-adapters.git@unit-testing-case-insensitive-comparisons
MichelleArk marked this conversation as resolved.
Show resolved Hide resolved
git+https://github.com/dbt-labs/dbt-adapters.git@unit-testing-case-insensitive-comparisons#subdirectory=dbt-tests-adapter

# if version 1.x or greater -> pin to major version
# if version 0.x -> pin to minor
Expand Down
10 changes: 10 additions & 0 deletions tests/functional/adapter/unit_testing/test_unit_testing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from dbt.tests.adapter.unit_testing.test_case_insensitivity import BaseUnitTestCaseInsensivity
from dbt.tests.adapter.unit_testing.test_invalid_input import BaseUnitTestInvalidInput


class TestSparkUnitTestCaseInsensitivity(BaseUnitTestCaseInsensivity):
pass


class TestSparkUnitTestInvalidInput(BaseUnitTestInvalidInput):
pass
Loading