Coverage for /pythoncovmergedfiles/medio/medio/src/airflow/tests/system/example_empty.py: 23%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

1# Licensed to the Apache Software Foundation (ASF) under one 

2# or more contributor license agreements. See the NOTICE file 

3# distributed with this work for additional information 

4# regarding copyright ownership. The ASF licenses this file 

5# to you under the Apache License, Version 2.0 (the 

6# "License"); you may not use this file except in compliance 

7# with the License. You may obtain a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, 

12# software distributed under the License is distributed on an 

13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 

14# KIND, either express or implied. See the License for the 

15# specific language governing permissions and limitations 

16# under the License. 

17from __future__ import annotations 

18 

19from datetime import datetime 

20 

21from airflow.models.baseoperator import chain 

22from airflow.models.dag import DAG 

23from airflow.operators.empty import EmptyOperator 

24 

25DAG_ID = "example_empty" 

26 

27with DAG( 

28 dag_id=DAG_ID, 

29 schedule="@once", 

30 start_date=datetime(2021, 1, 1), 

31 tags=["example"], 

32 catchup=False, 

33) as dag: 

34 task = EmptyOperator(task_id="task") 

35 

36 chain(task) 

37 

38 from tests.system.utils.watcher import watcher 

39 

40 # This test needs watcher in order to properly mark success/failure 

41 # when "tearDown" task with trigger rule is part of the DAG 

42 list(dag.tasks) >> watcher() 

43 

44 

45from tests.system.utils import get_test_run # noqa: E402 

46 

47# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) 

48test_run = get_test_run(dag)