def run_schema_and_assert(self, include, exclude, expected_tests):
        self.run_sql_file("test/integration/007_graph_selection_tests/seed.sql")
        self.run_dbt(["deps"])
        results = self.run_dbt(['run', '--exclude', 'never_selected'])
        self.assertEqual(len(results), 9)

        args = FakeArgs()
        args.models = include
        args.exclude = exclude

        test_task = TestTask(args, self.config)
        test_results = test_task.run()

        ran_tests = sorted([test.node.get('name') for test in test_results])
        expected_sorted = sorted(expected_tests)

        self.assertEqual(ran_tests, expected_sorted)
Exemplo n.º 2
0
    def run_data_validations(self):
        args = FakeArgs()
        args.data = True

        test_task = TestTask(args, self.config)
        return test_task.run()
Exemplo n.º 3
0
    def run_schema_validations(self):
        project = read_project('dbt_project.yml')
        args = FakeArgs()

        test_task = TestTask(args, project)
        return test_task.run()
Exemplo n.º 4
0
    def run_schema_validations(self):
        args = FakeArgs()

        test_task = TestTask(args, self.config)
        return test_task.run()
Exemplo n.º 5
0
    def get_compiler(self, project):
        compiler = dbt.compilation.Compiler(project, FakeArgs())

        compiler.get_macros = MagicMock(return_value=[])
        return compiler