From 009c632a84c88309b8fd3f59ed81c9379288c6a5 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 22 Apr 2024 16:13:16 -0700 Subject: [PATCH 1/3] fix BaseMacroArgsQueryComments package version to get it from dbt-core --- .../dbt/tests/adapter/query_comment/test_query_comment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py b/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py index 66251c1d..8cf99892 100644 --- a/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py +++ b/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py @@ -55,7 +55,7 @@ def test_matches_comment(self, project): class BaseMacroArgsQueryComments(BaseDefaultQueryComments): @pytest.fixture(scope="class") def get_package_version(self, project): - return import_module("." + project.adapter_type, "dbt.adapters").__version__.version + return import_module("dbt.version").__version__ @pytest.fixture(scope="class") def project_config_update(self): From 99328b3bd3c60826ce54782fdda9d2ebbdd1594d Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 23 Apr 2024 09:47:43 -0700 Subject: [PATCH 2/3] remove dbt_version from query comment test fixture --- .../dbt/tests/adapter/query_comment/fixtures.py | 1 - .../dbt/tests/adapter/query_comment/test_query_comment.py | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/dbt-tests-adapter/dbt/tests/adapter/query_comment/fixtures.py b/dbt-tests-adapter/dbt/tests/adapter/query_comment/fixtures.py index d8848dc0..ccaf3292 100644 --- a/dbt-tests-adapter/dbt/tests/adapter/query_comment/fixtures.py +++ b/dbt-tests-adapter/dbt/tests/adapter/query_comment/fixtures.py @@ -10,7 +10,6 @@ {%- set comment_dict = dict( app='dbt++', macro_version='0.1.0', - dbt_version=dbt_version, message='blah: '~ message) -%} {{ return(comment_dict) }} {%- endmacro -%} diff --git a/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py b/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py index 8cf99892..4453c273 100644 --- a/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py +++ b/dbt-tests-adapter/dbt/tests/adapter/query_comment/test_query_comment.py @@ -1,5 +1,4 @@ import json -from importlib import import_module import pytest from dbt_common.exceptions import DbtRuntimeError @@ -53,19 +52,15 @@ def test_matches_comment(self, project): class BaseMacroArgsQueryComments(BaseDefaultQueryComments): - @pytest.fixture(scope="class") - def get_package_version(self, project): - return import_module("dbt.version").__version__ @pytest.fixture(scope="class") def project_config_update(self): return {"query-comment": "{{ return(ordered_to_json(query_header_args(target.name))) }}"} - def test_matches_comment(self, project, get_package_version): + def test_matches_comment(self, project): logs = self.run_get_json() expected_dct = { "app": "dbt++", - "dbt_version": get_package_version, "macro_version": "0.1.0", "message": f"blah: {project.adapter.config.target_name}", } From d97d5c423a1ee2b1b0245d65646c3f197d8b9eb2 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 23 Apr 2024 09:48:54 -0700 Subject: [PATCH 3/3] add changie --- .changes/unreleased/Under the Hood-20240423-094843.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Under the Hood-20240423-094843.yaml diff --git a/.changes/unreleased/Under the Hood-20240423-094843.yaml b/.changes/unreleased/Under the Hood-20240423-094843.yaml new file mode 100644 index 00000000..664f39a6 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240423-094843.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: remove dbt_version from query comment test fixture +time: 2024-04-23T09:48:43.208035-07:00 +custom: + Author: colin-rogers-dbt + Issue: "184"