Skip to content

Commit 152c35e

Browse files
committed
simplify debug tests
1 parent 37f11f8 commit 152c35e

File tree

1 file changed

+9
-55
lines changed

1 file changed

+9
-55
lines changed
Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,17 @@
1-
import os
2-
import re
3-
4-
import yaml
5-
from dbt.tests.adapter.dbt_debug.test_dbt_debug import BaseDebug, BaseDebugProfileVariable
6-
from dbt.tests.util import run_dbt
7-
8-
9-
class TestDebugSQLServer(BaseDebug):
10-
def test_ok(self, project):
11-
run_dbt(["debug"])
12-
assert "ERROR" not in self.capsys.readouterr().out
13-
14-
def test_nopass(self, project):
15-
run_dbt(["debug", "--target", "nopass"], expect_pass=False)
16-
self.assertGotValue(re.compile(r"\s+profiles\.yml file"), "ERROR invalid")
17-
18-
def test_wronguser(self, project):
19-
run_dbt(["debug", "--target", "wronguser"], expect_pass=False)
20-
self.assertGotValue(re.compile(r"\s+Connection test"), "ERROR")
21-
22-
def test_empty_target(self, project):
23-
run_dbt(["debug", "--target", "none_target"], expect_pass=False)
24-
self.assertGotValue(re.compile(r"\s+output 'none_target'"), "misconfigured")
1+
from dbt.tests.adapter.dbt_debug.test_dbt_debug import BaseDebugProfileVariable
2+
from dbt.tests.adapter.dbt_debug.test_dbt_debug import (
3+
TestDebugInvalidProjectPostgres as BaseDebugInvalidProject,
4+
)
5+
from dbt.tests.adapter.dbt_debug.test_dbt_debug import TestDebugPostgres as BaseBaseDebug
256

267

278
class TestDebugProfileVariableSQLServer(BaseDebugProfileVariable):
289
pass
2910

3011

31-
class TestDebugInvalidProjectSQLServer(BaseDebug):
32-
def test_empty_project(self, project):
33-
with open("dbt_project.yml", "w") as f: # noqa: F841
34-
pass
35-
36-
run_dbt(["debug", "--profile", "test"], expect_pass=False)
37-
splitout = self.capsys.readouterr().out.split("\n")
38-
self.check_project(splitout)
39-
40-
def test_badproject(self, project):
41-
update_project = {"invalid-key": "not a valid key so this is bad project"}
42-
43-
with open("dbt_project.yml", "w") as f:
44-
yaml.safe_dump(update_project, f)
45-
46-
run_dbt(["debug", "--profile", "test"], expect_pass=False)
47-
splitout = self.capsys.readouterr().out.split("\n")
48-
self.check_project(splitout)
12+
class TestDebugInvalidProjectSQLServer(BaseDebugInvalidProject):
13+
pass
4914

50-
def test_not_found_project(self, project):
51-
run_dbt(["debug", "--project-dir", "nopass"], expect_pass=False)
52-
splitout = self.capsys.readouterr().out.split("\n")
53-
self.check_project(splitout, msg="ERROR not found")
5415

55-
def test_invalid_project_outside_current_dir(self, project):
56-
# create a dbt_project.yml
57-
project_config = {"invalid-key": "not a valid key in this project"}
58-
os.makedirs("custom", exist_ok=True)
59-
with open("custom/dbt_project.yml", "w") as f:
60-
yaml.safe_dump(project_config, f, default_flow_style=True)
61-
run_dbt(["debug", "--project-dir", "custom"], expect_pass=False)
62-
splitout = self.capsys.readouterr().out.split("\n")
63-
self.check_project(splitout)
16+
class TestDebugSQLServer(BaseBaseDebug):
17+
pass

0 commit comments

Comments
 (0)