Exemple #1
0
 def test_cli_test(self):
     cli.test(self.parser.parse_args([
         'test', 'example_bash_operator', 'runme_0',
         DEFAULT_DATE.isoformat()]))
     cli.test(self.parser.parse_args([
         'test', 'example_bash_operator', 'runme_0', '--dry_run',
         DEFAULT_DATE.isoformat()]))
Exemple #2
0
 def test_cli_test(self):
     cli.test(self.parser.parse_args([
         'test', 'example_bash_operator', 'runme_0',
         DEFAULT_DATE.isoformat()]))
     cli.test(self.parser.parse_args([
         'test', 'example_bash_operator', 'runme_0', '--dry_run',
         DEFAULT_DATE.isoformat()]))
Exemple #3
0
 def test_cli_test_with_params(self):
     cli.test(self.parser.parse_args([
         'tasks', 'test', 'example_passing_params_via_test_command', 'run_this',
         '-tp', '{"foo":"bar"}', DEFAULT_DATE.isoformat()]))
     cli.test(self.parser.parse_args([
         'tasks', 'test', 'example_passing_params_via_test_command', 'also_run_this',
         '-tp', '{"foo":"bar"}', DEFAULT_DATE.isoformat()]))
    def test_test(self):
        """Test the `airflow test` command"""
        args = create_mock_args(task_id='print_the_context',
                                dag_id='example_python_operator',
                                subdir=None,
                                execution_date=timezone.parse('2018-01-01'))

        saved_stdout = sys.stdout
        try:
            sys.stdout = out = io.StringIO()
            cli.test(args)

            output = out.getvalue()
            # Check that prints, and log messages, are shown
            self.assertIn(
                "'example_python_operator__print_the_context__20180101'",
                output)
        finally:
            sys.stdout = saved_stdout
Exemple #5
0
    def test_test(self):
        """Test the `airflow test` command"""
        args = create_mock_args(
            task_id='print_the_context',
            dag_id='example_python_operator',
            subdir=None,
            execution_date=timezone.parse('2018-01-01')
        )

        saved_stdout = sys.stdout
        try:
            sys.stdout = out = StringIO()
            cli.test(args)

            output = out.getvalue()
            # Check that prints, and log messages, are shown
            self.assertIn('END_DATE', output)
            self.assertIn("'example_python_operator__print_the_context__20180101'", output)
        finally:
            sys.stdout = saved_stdout
Exemple #6
0
 def test_cli_test(self):
     cli.test(self.parser.parse_args(["test", "example_bash_operator", "runme_0", DEFAULT_DATE.isoformat()]))
     cli.test(
         self.parser.parse_args(["test", "example_bash_operator", "runme_0", "--dry_run", DEFAULT_DATE.isoformat()])
     )