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

Fix Test QueryCommentArgs #59

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Changes from all 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
10 changes: 7 additions & 3 deletions dbt/tests/adapter/query_comment/test_query_comment.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
from importlib import import_module

import pytest
from dbt_common.exceptions import DbtRuntimeError

from dbt.tests.__about__ import version as PACKAGE_VERSION
from dbt.tests.adapter.query_comment import fixtures
from dbt.tests.util import run_dbt_and_capture

Expand Down Expand Up @@ -53,15 +53,19 @@ 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):
def test_matches_comment(self, project, get_package_version):
logs = self.run_get_json()
expected_dct = {
"app": "dbt++",
"dbt_version": PACKAGE_VERSION,
"dbt_version": get_package_version,
"macro_version": "0.1.0",
"message": f"blah: {project.adapter.config.target_name}",
}
Expand Down
Loading