Skip to content

Commit 51b043e

Browse files
committed
removed unnecessary parameter from validate_vars_not_in_both
1 parent 70ba7d5 commit 51b043e

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

core/dbt/config/project.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def vars_data_from_root(project_root: str) -> Dict[str, Any]:
122122

123123

124124
def validate_vars_not_in_both(
125-
project_root: str,
126125
project_dict: Dict[str, Any],
127126
has_vars_file: bool,
128127
) -> None:
@@ -132,7 +131,6 @@ def validate_vars_not_in_both(
132131
if has_vars_file and has_project_vars:
133132
raise DbtProjectError(
134133
f"Variables cannot be defined in both {VARS_FILE_NAME} and {DBT_PROJECT_FILE_NAME}. "
135-
f"Please use only one location for defining variables in project at '{project_root}'."
136134
)
137135

138136

@@ -834,7 +832,7 @@ def from_project_root(
834832
)
835833

836834
# Check mutual exclusivity before rendering
837-
validate_vars_not_in_both(project_root, partial.project_dict, bool(vars_from_file))
835+
validate_vars_not_in_both(partial.project_dict, bool(vars_from_file))
838836

839837
return partial.render(renderer, vars_from_file=vars_from_file)
840838

tests/unit/config/test_vars_file.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ class TestValidateVarsNotInBoth:
7676
def test_no_error_when_no_vars_file_and_no_project_vars(self) -> None:
7777
"""Should not raise when neither vars.yml nor dbt_project.yml have vars."""
7878
project_dict: Dict[str, Any] = {"name": "test_project"}
79-
validate_vars_not_in_both("/test/path", project_dict, has_vars_file=False)
79+
validate_vars_not_in_both(project_dict, has_vars_file=False)
8080

8181
def test_no_error_when_only_vars_file_has_vars(self) -> None:
8282
"""Should not raise when only vars.yml has vars."""
8383
project_dict: Dict[str, Any] = {"name": "test_project"}
84-
validate_vars_not_in_both("/test/path", project_dict, has_vars_file=True)
84+
validate_vars_not_in_both(project_dict, has_vars_file=True)
8585

8686
def test_no_error_when_only_project_has_vars(self) -> None:
8787
"""Should not raise when only dbt_project.yml has vars."""
8888
project_dict: Dict[str, Any] = {
8989
"name": "test_project",
9090
"vars": {"my_var": "my_value"},
9191
}
92-
validate_vars_not_in_both("/test/path", project_dict, has_vars_file=False)
92+
validate_vars_not_in_both(project_dict, has_vars_file=False)
9393

9494
def test_error_when_both_have_vars(self) -> None:
9595
"""Should raise DbtProjectError when both sources have vars."""
@@ -98,11 +98,10 @@ def test_error_when_both_have_vars(self) -> None:
9898
"vars": {"my_var": "my_value"},
9999
}
100100
with pytest.raises(DbtProjectError) as exc_info:
101-
validate_vars_not_in_both("/test/path", project_dict, has_vars_file=True)
101+
validate_vars_not_in_both(project_dict, has_vars_file=True)
102102

103103
assert "vars.yml" in str(exc_info.value)
104104
assert "dbt_project.yml" in str(exc_info.value)
105-
assert "/test/path" in str(exc_info.value)
106105

107106
def test_no_error_when_project_vars_is_empty(self) -> None:
108107
"""Should not raise when dbt_project.yml vars is empty dict."""
@@ -111,15 +110,15 @@ def test_no_error_when_project_vars_is_empty(self) -> None:
111110
"vars": {},
112111
}
113112
# Empty vars dict is falsy, so this should not raise
114-
validate_vars_not_in_both("/test/path", project_dict, has_vars_file=True)
113+
validate_vars_not_in_both(project_dict, has_vars_file=True)
115114

116115
def test_no_error_when_project_vars_is_none(self) -> None:
117116
"""Should not raise when dbt_project.yml vars is None."""
118117
project_dict: Dict[str, Any] = {
119118
"name": "test_project",
120119
"vars": None,
121120
}
122-
validate_vars_not_in_both("/test/path", project_dict, has_vars_file=True)
121+
validate_vars_not_in_both(project_dict, has_vars_file=True)
123122

124123

125124
class TestVarProviderWithVarsFromFile:

0 commit comments

Comments
 (0)