diff --git a/tests/functional/show/test_show.py b/tests/functional/show/test_show.py index a8db41d26a0..4420d02a551 100644 --- a/tests/functional/show/test_show.py +++ b/tests/functional/show/test_show.py @@ -15,7 +15,7 @@ ) -class TestShow: +class BaseTestShow: @pytest.fixture(scope="class") def models(self): return { @@ -30,6 +30,8 @@ def models(self): def seeds(self): return {"sample_seed.csv": seeds__sample_seed} + +class TestNone(BaseTestShow): def test_none(self, project): with pytest.raises( DbtRuntimeError, match="Either --select or --inline must be passed to show" @@ -37,6 +39,8 @@ def test_none(self, project): run_dbt(["seed"]) run_dbt(["show"]) + +class TestSelectModelText(BaseTestShow): def test_select_model_text(self, project): run_dbt(["build"]) (results, log_output) = run_dbt_and_capture(["show", "--select", "second_model"]) @@ -46,6 +50,8 @@ def test_select_model_text(self, project): assert "col_two" in log_output assert "answer" in log_output + +class TestSelectMultModelText(BaseTestShow): def test_select_multiple_model_text(self, project): run_dbt(["build"]) (results, log_output) = run_dbt_and_capture( @@ -55,6 +61,8 @@ def test_select_multiple_model_text(self, project): assert "sample_num" in log_output assert "sample_bool" in log_output + +class TestSelectSingleMultModelJson(BaseTestShow): def test_select_single_model_json(self, project): run_dbt(["build"]) (results, log_output) = run_dbt_and_capture( @@ -64,6 +72,8 @@ def test_select_single_model_json(self, project): assert "sample_num" in log_output assert "sample_bool" in log_output + +class TestSelectNumerics(BaseTestShow): def test_numeric_values(self, project): run_dbt(["build"]) (results, log_output) = run_dbt_and_capture( @@ -77,6 +87,8 @@ def test_numeric_values(self, project): assert "5" in log_output assert "5.0" not in log_output + +class TestInlinePass(BaseTestShow): def test_inline_pass(self, project): run_dbt(["build"]) (results, log_output) = run_dbt_and_capture( @@ -86,6 +98,8 @@ def test_inline_pass(self, project): assert "sample_num" in log_output assert "sample_bool" in log_output + +class TestShowExceptions(BaseTestShow): def test_inline_fail(self, project): with pytest.raises(DbtException, match="Error parsing inline query"): run_dbt(["show", "--inline", "select * from {{ ref('third_model') }}"]) @@ -94,6 +108,8 @@ def test_inline_fail_database_error(self, project): with pytest.raises(DbtRuntimeError, match="Database Error"): run_dbt(["show", "--inline", "slect asdlkjfsld;j"]) + +class TestEphemeralModels(BaseTestShow): def test_ephemeral_model(self, project): run_dbt(["build"]) (results, log_output) = run_dbt_and_capture(["show", "--select", "ephemeral_model"]) @@ -106,6 +122,8 @@ def test_second_ephemeral_model(self, project): ) assert "col_hundo" in log_output + +class TestLimit(BaseTestShow): @pytest.mark.parametrize( "args,expected", [ @@ -120,10 +138,14 @@ def test_limit(self, project, args, expected): results, log_output = run_dbt_and_capture(dbt_args) assert len(results.results[0].agate_table) == expected + +class TestSeed(BaseTestShow): def test_seed(self, project): (results, log_output) = run_dbt_and_capture(["show", "--select", "sample_seed"]) assert "Previewing node 'sample_seed'" in log_output + +class TestSqlHeader(BaseTestShow): def test_sql_header(self, project): run_dbt(["build"]) (results, log_output) = run_dbt_and_capture(["show", "--select", "sql_header"])