From 596b44cc0ab8ad23982e82540db0b75f1c50f215 Mon Sep 17 00:00:00 2001 From: Colin Rogers <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:32:22 -0700 Subject: [PATCH] fix BaseMacroArgsQueryComments by removing ref to dbt_version in fixture (#184) --- .changes/unreleased/Under the Hood-20240423-094843.yaml | 6 ++++++ .../dbt/tests/adapter/query_comment/fixtures.py | 1 - .../dbt/tests/adapter/query_comment/test_query_comment.py | 7 +------ 3 files changed, 7 insertions(+), 7 deletions(-) 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" 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 66251c1d..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("." + project.adapter_type, "dbt.adapters").__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}", }