Skip to content

Commit 03a5231

Browse files
authored
split up tests into classes (#8475)
# Conflicts: # tests/functional/show/test_show.py
1 parent 4cfc662 commit 03a5231

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/functional/show/test_show.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
)
1616

1717

18-
class TestShow:
18+
class BaseTestShow:
1919
@pytest.fixture(scope="class")
2020
def models(self):
2121
return {
@@ -30,13 +30,17 @@ def models(self):
3030
def seeds(self):
3131
return {"sample_seed.csv": seeds__sample_seed}
3232

33+
34+
class TestNone(BaseTestShow):
3335
def test_none(self, project):
3436
with pytest.raises(
3537
DbtRuntimeError, match="Either --select or --inline must be passed to show"
3638
):
3739
run_dbt(["seed"])
3840
run_dbt(["show"])
3941

42+
43+
class TestSelectModelText(BaseTestShow):
4044
def test_select_model_text(self, project):
4145
run_dbt(["build"])
4246
(results, log_output) = run_dbt_and_capture(["show", "--select", "second_model"])
@@ -46,6 +50,8 @@ def test_select_model_text(self, project):
4650
assert "col_two" in log_output
4751
assert "answer" in log_output
4852

53+
54+
class TestSelectMultModelText(BaseTestShow):
4955
def test_select_multiple_model_text(self, project):
5056
run_dbt(["build"])
5157
(results, log_output) = run_dbt_and_capture(
@@ -55,6 +61,8 @@ def test_select_multiple_model_text(self, project):
5561
assert "sample_num" in log_output
5662
assert "sample_bool" in log_output
5763

64+
65+
class TestSelectSingleMultModelJson(BaseTestShow):
5866
def test_select_single_model_json(self, project):
5967
run_dbt(["build"])
6068
(results, log_output) = run_dbt_and_capture(
@@ -64,6 +72,8 @@ def test_select_single_model_json(self, project):
6472
assert "sample_num" in log_output
6573
assert "sample_bool" in log_output
6674

75+
76+
class TestSelectNumerics(BaseTestShow):
6777
def test_numeric_values(self, project):
6878
run_dbt(["build"])
6979
(results, log_output) = run_dbt_and_capture(
@@ -77,6 +87,8 @@ def test_numeric_values(self, project):
7787
assert "5" in log_output
7888
assert "5.0" not in log_output
7989

90+
91+
class TestInlinePass(BaseTestShow):
8092
def test_inline_pass(self, project):
8193
run_dbt(["build"])
8294
(results, log_output) = run_dbt_and_capture(
@@ -86,6 +98,8 @@ def test_inline_pass(self, project):
8698
assert "sample_num" in log_output
8799
assert "sample_bool" in log_output
88100

101+
102+
class TestShowExceptions(BaseTestShow):
89103
def test_inline_fail(self, project):
90104
with pytest.raises(DbtException, match="Error parsing inline query"):
91105
run_dbt(["show", "--inline", "select * from {{ ref('third_model') }}"])
@@ -94,6 +108,8 @@ def test_inline_fail_database_error(self, project):
94108
with pytest.raises(DbtRuntimeError, match="Database Error"):
95109
run_dbt(["show", "--inline", "slect asdlkjfsld;j"])
96110

111+
112+
class TestEphemeralModels(BaseTestShow):
97113
def test_ephemeral_model(self, project):
98114
run_dbt(["build"])
99115
(results, log_output) = run_dbt_and_capture(["show", "--select", "ephemeral_model"])
@@ -106,6 +122,8 @@ def test_second_ephemeral_model(self, project):
106122
)
107123
assert "col_hundo" in log_output
108124

125+
126+
class TestLimit(BaseTestShow):
109127
@pytest.mark.parametrize(
110128
"args,expected",
111129
[
@@ -120,10 +138,14 @@ def test_limit(self, project, args, expected):
120138
results, log_output = run_dbt_and_capture(dbt_args)
121139
assert len(results.results[0].agate_table) == expected
122140

141+
142+
class TestSeed(BaseTestShow):
123143
def test_seed(self, project):
124144
(results, log_output) = run_dbt_and_capture(["show", "--select", "sample_seed"])
125145
assert "Previewing node 'sample_seed'" in log_output
126146

147+
148+
class TestSqlHeader(BaseTestShow):
127149
def test_sql_header(self, project):
128150
run_dbt(["build"])
129151
(results, log_output) = run_dbt_and_capture(["show", "--select", "sql_header"])

0 commit comments

Comments
 (0)