From f194419561b164c5a07c14f14bcf0dad4990c270 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sun, 1 Jun 2025 11:45:34 +0200 Subject: [PATCH] [v3-0-test] Move example_dags in standard provider to example_dags in sources (#51260) Folow up after #51192. Actually choosing the same approach as for system tests was pretty wrong and even before attempting to have final solution for example_dags/system tests we should move the standard examples out of "tests.system" as rightfully pointed out by Jed in the #51192. The snippets of code to run the tests as pytests are not neeeded and they are actually even harmful as they cause import errors when no tests_common is around (cherry picked from commit cc29e027ce777452c214187e675eb247a6e231ad) Co-authored-by: Jarek Potiuk --- airflow-core/docs/tutorial/taskflow.rst | 6 +-- .../src/airflow/example_dags/standard | 2 +- .../tests/unit/jobs/test_scheduler_job.py | 38 +++++++++++------- devel-common/src/docs/provider_conf.py | 10 ++--- docs/spelling_wordlist.txt | 1 + providers/arangodb/docs/index.rst | 8 +--- providers/edge3/docs/index.rst | 7 ++++ .../edge3/example_dags/win_notepad.py | 2 +- providers/oracle/docs/index.rst | 2 +- providers/standard/docs/index.rst | 9 +---- providers/standard/docs/operators/bash.rst | 18 ++++----- .../standard/docs/operators/datetime.rst | 8 ++-- .../standard/docs/operators/latest_only.rst | 2 +- providers/standard/docs/operators/python.rst | 40 +++++++++---------- .../docs/operators/trigger_dag_run.rst | 2 +- providers/standard/docs/sensors/bash.rst | 2 +- providers/standard/docs/sensors/datetime.rst | 8 ++-- .../docs/sensors/external_task_sensor.rst | 8 ++-- providers/standard/docs/sensors/file.rst | 4 +- providers/standard/docs/sensors/python.rst | 4 +- .../standard/example_dags}/__init__.py | 0 .../example_dags}/example_bash_decorator.py | 6 --- .../example_dags}/example_bash_operator.py | 6 --- .../example_branch_datetime_operator.py | 8 ---- .../example_branch_day_of_week_operator.py | 6 --- .../example_dags}/example_branch_operator.py | 6 --- .../example_branch_operator_decorator.py | 6 --- .../example_external_task_child_deferrable.py | 6 --- .../example_external_task_marker_dag.py | 6 --- ...example_external_task_parent_deferrable.py | 6 --- .../example_dags}/example_latest_only.py | 6 --- .../example_dags}/example_python_decorator.py | 6 --- .../example_dags}/example_python_operator.py | 6 --- .../example_dags}/example_sensor_decorator.py | 6 --- .../standard/example_dags}/example_sensors.py | 6 --- .../example_short_circuit_decorator.py | 6 --- .../example_short_circuit_operator.py | 6 --- .../example_trigger_controller_dag.py | 6 --- .../standard/example_dags}/sql/__init__.py | 0 .../standard/example_dags}/sql/sample.sql | 0 providers/standard/tests/system/__init__.py | 17 -------- 41 files changed, 91 insertions(+), 211 deletions(-) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/__init__.py (100%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_bash_decorator.py (95%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_bash_operator.py (92%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_branch_datetime_operator.py (93%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_branch_day_of_week_operator.py (92%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_branch_operator.py (96%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_branch_operator_decorator.py (96%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_external_task_child_deferrable.py (87%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_external_task_marker_dag.py (94%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_external_task_parent_deferrable.py (92%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_latest_only.py (88%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_python_decorator.py (95%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_python_operator.py (96%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_sensor_decorator.py (90%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_sensors.py (95%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_short_circuit_decorator.py (92%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_short_circuit_operator.py (92%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/example_trigger_controller_dag.py (90%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/sql/__init__.py (100%) rename providers/standard/{tests/system/standard => src/airflow/providers/standard/example_dags}/sql/sample.sql (100%) delete mode 100644 providers/standard/tests/system/__init__.py diff --git a/airflow-core/docs/tutorial/taskflow.rst b/airflow-core/docs/tutorial/taskflow.rst index baf6f7e04af32..11bfc1b47b499 100644 --- a/airflow-core/docs/tutorial/taskflow.rst +++ b/airflow-core/docs/tutorial/taskflow.rst @@ -270,7 +270,7 @@ system-level packages. TaskFlow supports multiple execution environments to isol Creates a temporary virtualenv at task runtime. Great for experimental or dynamic tasks, but may have cold start overhead. -.. exampleinclude:: /../../providers/standard/tests/system/standard/example_python_decorator.py +.. exampleinclude:: /../../providers/standard/src/airflow/providers/standard/example_dags//example_python_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_python_venv] @@ -284,7 +284,7 @@ overhead. Executes the task using a pre-installed Python interpreter — ideal for consistent environments or shared virtualenvs. -.. exampleinclude:: /../../providers/standard/tests/system/standard/example_python_decorator.py +.. exampleinclude:: /../../providers/standard/src/airflow/providers/standard/example_dags//example_python_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_external_python] @@ -334,7 +334,7 @@ Using Sensors Use ``@task.sensor`` to build lightweight, reusable sensors using Python functions. These support both poke and reschedule modes. -.. exampleinclude:: /../../providers/standard/tests/system/standard/example_sensor_decorator.py +.. exampleinclude:: /../../providers/standard/src/airflow/providers/standard/example_dags//example_sensor_decorator.py :language: python :start-after: [START tutorial] :end-before: [END tutorial] diff --git a/airflow-core/src/airflow/example_dags/standard b/airflow-core/src/airflow/example_dags/standard index c5f1f37b5270a..3c2ef23d52c55 120000 --- a/airflow-core/src/airflow/example_dags/standard +++ b/airflow-core/src/airflow/example_dags/standard @@ -1 +1 @@ -../../../../providers/standard/tests/system/standard/ \ No newline at end of file +../../../../providers/standard/src/airflow/providers/standard/example_dags \ No newline at end of file diff --git a/airflow-core/tests/unit/jobs/test_scheduler_job.py b/airflow-core/tests/unit/jobs/test_scheduler_job.py index c1f926cfdbed0..9caeb067e09ad 100644 --- a/airflow-core/tests/unit/jobs/test_scheduler_job.py +++ b/airflow-core/tests/unit/jobs/test_scheduler_job.py @@ -74,7 +74,7 @@ from airflow.utils.thread_safe_dict import ThreadSafeDict from airflow.utils.types import DagRunTriggeredByType, DagRunType -from system import standard +from tests_common.pytest_plugin import AIRFLOW_ROOT_PATH from tests_common.test_utils.asserts import assert_queries_count from tests_common.test_utils.config import conf_vars, env_vars from tests_common.test_utils.db import ( @@ -97,14 +97,20 @@ pytestmark = pytest.mark.db_test -ROOT_FOLDER = os.path.realpath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir) -) -PERF_DAGS_FOLDER = os.path.join(ROOT_FOLDER, "tests", "test_utils", "perf", "dags") +PERF_DAGS_FOLDER = AIRFLOW_ROOT_PATH / "dev" / "airflow_perf" / "dags" ELASTIC_DAG_FILE = os.path.join(PERF_DAGS_FOLDER, "elastic_dag.py") TEST_DAG_FOLDER = os.environ["AIRFLOW__CORE__DAGS_FOLDER"] -EXAMPLE_STANDARD_DAGS_FOLDER = standard.__path__[0] +EXAMPLE_STANDARD_DAGS_FOLDER = ( + AIRFLOW_ROOT_PATH + / "providers" + / "standard" + / "src" + / "airflow" + / "providers" + / "standard" + / "example_dags" +) DEFAULT_DATE = timezone.datetime(2016, 1, 1) DEFAULT_LOGICAL_DATE = timezone.coerce_datetime(DEFAULT_DATE) TRY_NUMBER = 1 @@ -6487,7 +6493,7 @@ def per_test(self) -> Generator: [ (21, 1, 1), # One DAG with one task per DAG file. (21, 1, 5), # One DAG with five tasks per DAG file. - (93, 10, 10), # 10 DAGs with 10 tasks per DAG file. + (148, 10, 10), # 10 DAGs with 10 tasks per DAG file. ], ) def test_execute_queries_count_with_harvested_dags( @@ -6528,7 +6534,9 @@ def test_execute_queries_count_with_harvested_dags( dr = dag.create_dagrun( state=State.RUNNING, run_id=f"{DagRunType.MANUAL.value}__{i}", - dag_hash=dagbag.dags_hash[dag.dag_id], + run_after=pendulum.datetime(2025, 1, 1, tz="UTC"), + run_type=DagRunType.MANUAL, + triggered_by=DagRunTriggeredByType.TEST, ) dagruns.append(dr) for ti in dr.get_task_instances(): @@ -6574,13 +6582,13 @@ def test_execute_queries_count_with_harvested_dags( # 10 DAGs with 10 tasks per DAG file. ([10, 10, 10, 10], 10, 10, "1d", "None", "no_structure"), ([10, 10, 10, 10], 10, 10, "1d", "None", "linear"), - ([105, 38, 38, 38], 10, 10, "1d", "@once", "no_structure"), - ([115, 51, 51, 51], 10, 10, "1d", "@once", "linear"), - ([105, 119, 119, 119], 10, 10, "1d", "30m", "no_structure"), - ([115, 145, 145, 145], 10, 10, "1d", "30m", "linear"), - ([115, 139, 139, 139], 10, 10, "1d", "30m", "binary_tree"), - ([115, 139, 139, 139], 10, 10, "1d", "30m", "star"), - ([115, 139, 139, 139], 10, 10, "1d", "30m", "grid"), + ([218, 69, 69, 69], 10, 10, "1d", "@once", "no_structure"), + ([228, 84, 84, 84], 10, 10, "1d", "@once", "linear"), + ([217, 119, 119, 119], 10, 10, "1d", "30m", "no_structure"), + ([2227, 145, 145, 145], 10, 10, "1d", "30m", "linear"), + ([227, 139, 139, 139], 10, 10, "1d", "30m", "binary_tree"), + ([227, 139, 139, 139], 10, 10, "1d", "30m", "star"), + ([227, 259, 259, 259], 10, 10, "1d", "30m", "grid"), ], ) def test_process_dags_queries_count( diff --git a/devel-common/src/docs/provider_conf.py b/devel-common/src/docs/provider_conf.py index 4b3f433ab763f..ce5f09188d336 100644 --- a/devel-common/src/docs/provider_conf.py +++ b/devel-common/src/docs/provider_conf.py @@ -61,7 +61,6 @@ get_html_theme_options, get_intersphinx_mapping, get_rst_epilogue, - get_rst_filepath_from_path, ) from sphinx_exts.provider_yaml_utils import load_package_data @@ -161,10 +160,10 @@ *[f"_api/tests/system/{subpackage}/index.rst" for subpackage in empty_subpackages], ] -exclude_patterns.extend( - get_rst_filepath_from_path(f, AIRFLOW_REPO_ROOT_PATH) - for f in BASE_PROVIDER_SRC_PATH.rglob("example_dags") -) +# exclude_patterns.extend( +# get_rst_filepath_from_path(f, AIRFLOW_REPO_ROOT_PATH) +# for f in BASE_PROVIDER_SRC_PATH.rglob("example_dags") +# ) # Add any paths that contain templates here, relative to this directory. templates_path = ["templates"] @@ -296,7 +295,6 @@ ( "*/airflow/__init__.py", "*/airflow/providers/__init__.py", - "*/example_dags/*", "*/providers/__init__.py", "*/conf/*", ) diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 630e80ade9cb8..ebde20530a462 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -1311,6 +1311,7 @@ pluggable pluggy plyvel png +PoC PodManager podName PodSpec diff --git a/providers/arangodb/docs/index.rst b/providers/arangodb/docs/index.rst index 74c056af7379b..85cd0aa3c0a7d 100644 --- a/providers/arangodb/docs/index.rst +++ b/providers/arangodb/docs/index.rst @@ -49,13 +49,7 @@ :maxdepth: 1 :caption: Resources - Example DAGs - -.. toctree:: - :hidden: - :maxdepth: 1 - :caption: Resources - + Example DAGs <_api/airflow/providers/arangodb/example_dags/index> PyPI Repository Installing from sources diff --git a/providers/edge3/docs/index.rst b/providers/edge3/docs/index.rst index 92c3812920a70..a45c239ef86b6 100644 --- a/providers/edge3/docs/index.rst +++ b/providers/edge3/docs/index.rst @@ -47,6 +47,13 @@ Configuration CLI Python API <_api/airflow/providers/edge3/index> + +.. toctree:: + :hidden: + :maxdepth: 1 + :caption: Resources + + Example DAGs <_api/airflow/providers/edge3/example_dags/index> PyPI Repository Installing from sources diff --git a/providers/edge3/src/airflow/providers/edge3/example_dags/win_notepad.py b/providers/edge3/src/airflow/providers/edge3/example_dags/win_notepad.py index d59066261ac14..6b875dd2aca25 100644 --- a/providers/edge3/src/airflow/providers/edge3/example_dags/win_notepad.py +++ b/providers/edge3/src/airflow/providers/edge3/example_dags/win_notepad.py @@ -41,7 +41,7 @@ class NotepadOperator(BaseOperator): - """Example Operator Implementation which starts a Notepod.exe on WIndows.""" + """Example Operator Implementation which starts a ``Notepad.exe`` on Windows.""" template_fields: Sequence[str] = "text" diff --git a/providers/oracle/docs/index.rst b/providers/oracle/docs/index.rst index b05e5034ed36e..ffdf3687acc35 100644 --- a/providers/oracle/docs/index.rst +++ b/providers/oracle/docs/index.rst @@ -56,7 +56,7 @@ :maxdepth: 1 :caption: Resources - Example DAGs + Example DAGs <_api/airflow/providers/oracle/example_dags/index> PyPI Repository Installing from sources diff --git a/providers/standard/docs/index.rst b/providers/standard/docs/index.rst index 5ddaa7eef2484..88b11909db04b 100644 --- a/providers/standard/docs/index.rst +++ b/providers/standard/docs/index.rst @@ -38,19 +38,12 @@ Sensors Configuration -.. toctree:: - :hidden: - :maxdepth: 1 - :caption: System tests - - System Tests <_api/tests/system/standard/index> - .. toctree:: :hidden: :maxdepth: 1 :caption: Resources - Example DAGs + Example DAGs <_api/airflow/providers/standard/example_dags/index> PyPI Repository Installing from sources Python API <_api/airflow/providers/standard/index> diff --git a/providers/standard/docs/operators/bash.rst b/providers/standard/docs/operators/bash.rst index 0831403020c99..2026752478357 100644 --- a/providers/standard/docs/operators/bash.rst +++ b/providers/standard/docs/operators/bash.rst @@ -41,7 +41,7 @@ determined by: .. tab-item:: @task.bash :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_bash_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_decorator.py :language: python :dedent: 4 :start-after: [START howto_decorator_bash] @@ -50,7 +50,7 @@ determined by: .. tab-item:: BashOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_bash_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_bash] @@ -67,7 +67,7 @@ You can use :ref:`Jinja templates ` to parameterize t .. tab-item:: @task.bash :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_bash_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_decorator.py :language: python :dedent: 4 :start-after: [START howto_decorator_bash_template] @@ -76,7 +76,7 @@ You can use :ref:`Jinja templates ` to parameterize t .. tab-item:: BashOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_bash_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_bash_template] @@ -85,7 +85,7 @@ You can use :ref:`Jinja templates ` to parameterize t Using the ``@task.bash`` TaskFlow decorator allows you to return a formatted string and take advantage of having all :ref:`execution context variables directly accessible to decorated tasks `. -.. exampleinclude:: /../tests/system/standard/example_bash_decorator.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_decorator.py :language: python :dedent: 4 :start-after: [START howto_decorator_bash_context_vars] @@ -169,7 +169,7 @@ exit code if you pass ``skip_on_exit_code``). .. tab-item:: @task.bash :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_bash_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_decorator.py :language: python :dedent: 4 :start-after: [START howto_decorator_bash_skip] @@ -178,7 +178,7 @@ exit code if you pass ``skip_on_exit_code``). .. tab-item:: BashOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_bash_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_operator.py :language: python :start-after: [START howto_operator_bash_skip] :end-before: [END howto_operator_bash_skip] @@ -388,7 +388,7 @@ or even build the Bash command(s) to execute. For example, use conditional logic to determine task behavior: -.. exampleinclude:: /../tests/system/standard/example_bash_decorator.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_decorator.py :language: python :dedent: 4 :start-after: [START howto_decorator_bash_conditional] @@ -396,7 +396,7 @@ For example, use conditional logic to determine task behavior: Or call a function to help build a Bash command: -.. exampleinclude:: /../tests/system/standard/example_bash_decorator.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_bash_decorator.py :language: python :dedent: 4 :start-after: [START howto_decorator_bash_build_cmd] diff --git a/providers/standard/docs/operators/datetime.rst b/providers/standard/docs/operators/datetime.rst index 251e933cbad40..cc559b11be9c7 100644 --- a/providers/standard/docs/operators/datetime.rst +++ b/providers/standard/docs/operators/datetime.rst @@ -39,7 +39,7 @@ take some time between when the DAGRun was scheduled and executed and it might m the DAGRun was scheduled properly, the actual time used for branching decision will be different than the schedule time and the branching decision might be different depending on those delays. -.. exampleinclude:: /../tests/system/standard/example_branch_datetime_operator.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_datetime_operator.py :language: python :start-after: [START howto_branch_datetime_operator] :end-before: [END howto_branch_datetime_operator] @@ -50,7 +50,7 @@ the current date in order to allow comparisons with it. In the event that ``targ to a ``datetime.time`` that occurs before the given ``target_lower``, a day will be added to ``target_upper``. This is done to allow for time periods that span over two dates. -.. exampleinclude:: /../tests/system/standard/example_branch_datetime_operator.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_datetime_operator.py :language: python :start-after: [START howto_branch_datetime_operator_next_day] :end-before: [END howto_branch_datetime_operator_next_day] @@ -66,7 +66,7 @@ The usage is much more "data range" friendly. The ``logical_date`` does not chan it is not affected by execution delays, so this approach is suitable for idempotent DAG runs that might be back-filled. -.. exampleinclude:: /../tests/system/standard/example_branch_datetime_operator.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_datetime_operator.py :language: python :start-after: [START howto_branch_datetime_operator_logical_date] :end-before: [END howto_branch_datetime_operator_logical_date] @@ -78,7 +78,7 @@ BranchDayOfWeekOperator Use the :class:`~airflow.operators.weekday.BranchDayOfWeekOperator` to branch your workflow based on week day value. -.. exampleinclude:: /../tests/system/standard/example_branch_day_of_week_operator.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_day_of_week_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_day_of_week_branch] diff --git a/providers/standard/docs/operators/latest_only.rst b/providers/standard/docs/operators/latest_only.rst index 21e66a124917e..e0d48608da37c 100644 --- a/providers/standard/docs/operators/latest_only.rst +++ b/providers/standard/docs/operators/latest_only.rst @@ -24,7 +24,7 @@ LatestOnlyOperator Use the :class:`~airflow.providers.standard.operators.latest_only.LatestOnlyOperator`. -.. exampleinclude:: /../tests/system/standard/example_latest_only.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_latest_only.py :language: python :dedent: 4 :start-after: [START howto_operator_latest_only] diff --git a/providers/standard/docs/operators/python.rst b/providers/standard/docs/operators/python.rst index 8f6f8d7d68159..60e2c83b5f1e7 100644 --- a/providers/standard/docs/operators/python.rst +++ b/providers/standard/docs/operators/python.rst @@ -32,7 +32,7 @@ Use the :class:`~airflow.providers.standard.operators.python.PythonOperator` to .. tab-item:: @task :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_python_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_python] @@ -41,7 +41,7 @@ Use the :class:`~airflow.providers.standard.operators.python.PythonOperator` to .. tab-item:: PythonOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_python_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_python] @@ -57,7 +57,7 @@ Pass extra arguments to the ``@task`` decorated function as you would with a nor .. tab-item:: @task :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_python_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_python_kwargs] @@ -66,7 +66,7 @@ Pass extra arguments to the ``@task`` decorated function as you would with a nor .. tab-item:: PythonOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_python_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_python_kwargs] @@ -87,7 +87,7 @@ is evaluated as a :ref:`Jinja template `. .. tab-item:: @task :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_python_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_python_render_sql] @@ -96,7 +96,7 @@ is evaluated as a :ref:`Jinja template `. .. tab-item:: PythonOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_python_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_python_render_sql] @@ -137,7 +137,7 @@ smoother data exchange, while still effectively handling common Python objects a .. tab-item:: @task.virtualenv :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_python_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_python_venv] @@ -146,7 +146,7 @@ smoother data exchange, while still effectively handling common Python objects a .. tab-item:: PythonVirtualenvOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_python_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_python_venv] @@ -251,7 +251,7 @@ in main Airflow environment). .. tab-item:: @task.external_python :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_python_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_external_python] @@ -260,7 +260,7 @@ in main Airflow environment). .. tab-item:: ExternalPythonOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_python_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_python_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_external_python] @@ -308,7 +308,7 @@ tasks. .. tab-item:: @task.branch :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_branch_operator_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_operator_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_branch_python] @@ -317,7 +317,7 @@ tasks. .. tab-item:: PythonBranchOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_branch_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_branch_python] @@ -345,7 +345,7 @@ tasks and is a hybrid of the :class:`~airflow.providers.standard.operators.pytho .. tab-item:: @task.branch_virtualenv :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_branch_operator_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_operator_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_branch_virtualenv] @@ -354,7 +354,7 @@ tasks and is a hybrid of the :class:`~airflow.providers.standard.operators.pytho .. tab-item:: BranchPythonVirtualenvOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_branch_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_branch_virtualenv] @@ -383,7 +383,7 @@ external Python environment. .. tab-item:: @task.branch_external_python :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_branch_operator_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_operator_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_branch_ext_py] @@ -392,7 +392,7 @@ external Python environment. .. tab-item:: BranchExternalPythonOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_branch_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_branch_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_branch_ext_py] @@ -428,7 +428,7 @@ skipped. .. tab-item:: @task.short_circuit :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_short_circuit_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_short_circuit_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_short_circuit] @@ -437,7 +437,7 @@ skipped. .. tab-item:: ShortCircuitOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_short_circuit_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_short_circuit_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_short_circuit] @@ -463,7 +463,7 @@ tasks have completed running regardless of status (i.e. the ``TriggerRule.ALL_DO .. tab-item:: @task.short_circuit :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_short_circuit_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_short_circuit_decorator.py :language: python :dedent: 4 :start-after: [START howto_operator_short_circuit_trigger_rules] @@ -472,7 +472,7 @@ tasks have completed running regardless of status (i.e. the ``TriggerRule.ALL_DO .. tab-item:: ShortCircuitOperator :sync: operator - .. exampleinclude:: /../tests/system/standard/example_short_circuit_operator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_short_circuit_operator.py :language: python :dedent: 4 :start-after: [START howto_operator_short_circuit_trigger_rules] diff --git a/providers/standard/docs/operators/trigger_dag_run.rst b/providers/standard/docs/operators/trigger_dag_run.rst index 1db20b35eceef..be7414a2aee20 100644 --- a/providers/standard/docs/operators/trigger_dag_run.rst +++ b/providers/standard/docs/operators/trigger_dag_run.rst @@ -24,7 +24,7 @@ TriggerDagRunOperator Use the :class:`~airflow.providers.standard.operators.trigger_dagrun.TriggerDagRunOperator` to trigger dag from another dag. -.. exampleinclude:: /../tests/system/standard/example_trigger_controller_dag.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_trigger_controller_dag.py :language: python :dedent: 4 :start-after: [START howto_operator_trigger_dagrun] diff --git a/providers/standard/docs/sensors/bash.rst b/providers/standard/docs/sensors/bash.rst index 5acabb1172cf1..17bb9c10d66d7 100644 --- a/providers/standard/docs/sensors/bash.rst +++ b/providers/standard/docs/sensors/bash.rst @@ -25,7 +25,7 @@ BashSensor Use the :class:`~airflow.providers.standard.sensors.bash.BashSensor` to use arbitrary command for sensing. The command should return 0 when it succeeds, any other value otherwise. -.. exampleinclude:: /../tests/system/standard/example_sensors.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_bash_sensors] diff --git a/providers/standard/docs/sensors/datetime.rst b/providers/standard/docs/sensors/datetime.rst index aabff0f866dce..2abbfa0191843 100644 --- a/providers/standard/docs/sensors/datetime.rst +++ b/providers/standard/docs/sensors/datetime.rst @@ -25,7 +25,7 @@ TimeDeltaSensor Use the :class:`~airflow.providers.standard.sensors.time_delta.TimeDeltaSensor` to end sensing after specific time. -.. exampleinclude:: /../tests/system/standard/example_sensors.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_time_delta_sensor] @@ -41,7 +41,7 @@ Use the :class:`~airflow.providers.standard.sensors.time_delta.TimeDeltaSensorAs It is an async version of the operator and requires Triggerer to run. -.. exampleinclude:: /../tests/system/standard/example_sensors.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_time_delta_sensor_async] @@ -58,7 +58,7 @@ Use the :class:`~airflow.providers.standard.sensors.time_sensor.TimeSensor` to e Time will be evaluated against ``data_interval_end`` if present for the dag run, otherwise ``run_after`` will be used. -.. exampleinclude:: /../tests/system/standard/example_sensors.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_time_sensors] @@ -88,7 +88,7 @@ DayOfWeekSensor Use the :class:`~airflow.sensors.weekday.DayOfWeekSensor` to sense for day of week. -.. exampleinclude:: /../tests/system/standard/example_sensors.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_day_of_week_sensor] diff --git a/providers/standard/docs/sensors/external_task_sensor.rst b/providers/standard/docs/sensors/external_task_sensor.rst index 8aec0bb785891..bf8114c5a80ce 100644 --- a/providers/standard/docs/sensors/external_task_sensor.rst +++ b/providers/standard/docs/sensors/external_task_sensor.rst @@ -47,7 +47,7 @@ wait for another task on a different DAG for a specific ``execution_date``. ExternalTaskSensor also provide options to set if the Task on a remote DAG succeeded or failed via ``allowed_states`` and ``failed_states`` parameters. -.. exampleinclude:: /../tests/system/standard/example_external_task_marker_dag.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py :language: python :dedent: 4 :start-after: [START howto_operator_external_task_sensor] @@ -55,7 +55,7 @@ via ``allowed_states`` and ``failed_states`` parameters. Also for this action you can use sensor in the deferrable mode: -.. exampleinclude:: /../tests/system/standard/example_external_task_parent_deferrable.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_external_task_parent_deferrable.py :language: python :dedent: 4 :start-after: [START howto_external_task_async_sensor] @@ -67,7 +67,7 @@ ExternalTaskSensor with task_group dependency In Addition, we can also use the :class:`~airflow.providers.standard.sensors.external_task.ExternalTaskSensor` to make tasks on a DAG wait for another ``task_group`` on a different DAG for a specific ``execution_date``. -.. exampleinclude:: /../tests/system/standard/example_external_task_marker_dag.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py :language: python :dedent: 4 :start-after: [START howto_operator_external_task_sensor_with_task_group] @@ -81,7 +81,7 @@ on ``child_dag`` for a specific ``execution_date`` should also be cleared, ``Ext should be used. Note that ``child_task1`` will only be cleared if "Recursive" is selected when the user clears ``parent_task``. -.. exampleinclude:: /../tests/system/standard/example_external_task_marker_dag.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py :language: python :dedent: 4 :start-after: [START howto_operator_external_task_marker] diff --git a/providers/standard/docs/sensors/file.rst b/providers/standard/docs/sensors/file.rst index a2f2b42ce3fe7..893cabf106c52 100644 --- a/providers/standard/docs/sensors/file.rst +++ b/providers/standard/docs/sensors/file.rst @@ -26,7 +26,7 @@ Use the :class:`~airflow.providers.standard.sensors.filesystem.FileSensor` to de filesystem. You need to have connection defined to use it (pass connection id via ``fs_conn_id``). Default connection is ``fs_default``. -.. exampleinclude:: /../tests/system/standard/example_sensors.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_file_sensor] @@ -34,7 +34,7 @@ Default connection is ``fs_default``. Also for this job you can use sensor in the deferrable mode: -.. exampleinclude:: /../tests/system/standard/example_sensors.py +.. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_file_sensor_async] diff --git a/providers/standard/docs/sensors/python.rst b/providers/standard/docs/sensors/python.rst index 1850a272d3050..6a9118e8db077 100644 --- a/providers/standard/docs/sensors/python.rst +++ b/providers/standard/docs/sensors/python.rst @@ -34,7 +34,7 @@ value to be True. .. tab-item:: @task.sensor :sync: taskflow - .. exampleinclude:: /../tests/system/standard/example_sensor_decorator.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensor_decorator.py :language: python :dedent: 4 :start-after: [START wait_function] @@ -43,7 +43,7 @@ value to be True. .. tab-item:: PythonSensor :sync: operator - .. exampleinclude:: /../tests/system/standard/example_sensors.py + .. exampleinclude:: /../src/airflow/providers/standard/example_dags/example_sensors.py :language: python :dedent: 4 :start-after: [START example_python_sensors] diff --git a/providers/standard/tests/system/standard/__init__.py b/providers/standard/src/airflow/providers/standard/example_dags/__init__.py similarity index 100% rename from providers/standard/tests/system/standard/__init__.py rename to providers/standard/src/airflow/providers/standard/example_dags/__init__.py diff --git a/providers/standard/tests/system/standard/example_bash_decorator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_bash_decorator.py similarity index 95% rename from providers/standard/tests/system/standard/example_bash_decorator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_bash_decorator.py index ce95b62ce6f4c..89335c0686465 100644 --- a/providers/standard/tests/system/standard/example_bash_decorator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_bash_decorator.py @@ -112,9 +112,3 @@ def get_file_stats() -> str: example_bash_decorator() - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_bash_operator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_bash_operator.py similarity index 92% rename from providers/standard/tests/system/standard/example_bash_operator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_bash_operator.py index 7ef7c0db2efbe..a4fb3161ab67d 100644 --- a/providers/standard/tests/system/standard/example_bash_operator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_bash_operator.py @@ -72,9 +72,3 @@ ) # [END howto_operator_bash_skip] this_will_skip >> run_this_last - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_branch_datetime_operator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_datetime_operator.py similarity index 93% rename from providers/standard/tests/system/standard/example_branch_datetime_operator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_branch_datetime_operator.py index b1e7564133323..710bdb1de898c 100644 --- a/providers/standard/tests/system/standard/example_branch_datetime_operator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_datetime_operator.py @@ -103,11 +103,3 @@ # Run empty_task_13 if cond3 executes between 2020-10-10 14:00:00 and 2020-10-10 15:00:00 cond3 >> [empty_task_13, empty_task_23] # [END howto_branch_datetime_operator_logical_date] - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag1) -test_run2 = get_test_run(dag2) -test_run3 = get_test_run(dag3) diff --git a/providers/standard/tests/system/standard/example_branch_day_of_week_operator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_day_of_week_operator.py similarity index 92% rename from providers/standard/tests/system/standard/example_branch_day_of_week_operator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_branch_day_of_week_operator.py index 3b541d2712d44..43400522468f7 100644 --- a/providers/standard/tests/system/standard/example_branch_day_of_week_operator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_day_of_week_operator.py @@ -59,9 +59,3 @@ # Run empty_task_3 if it's a weekend, empty_task_4 otherwise empty_task_2 >> branch_weekend >> [empty_task_3, empty_task_4] # [END howto_operator_day_of_week_branch] - - -from tests_common.test_utils.system_tests import get_test_run - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_branch_operator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_operator.py similarity index 96% rename from providers/standard/tests/system/standard/example_branch_operator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_branch_operator.py index 98c85444cdd3a..0bb429a6f8fe0 100644 --- a/providers/standard/tests/system/standard/example_branch_operator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_operator.py @@ -164,9 +164,3 @@ def hello_world_with_venv(): # Label is optional here, but it can help identify more complex branches branching_venv >> Label(option) >> t >> join_venv - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_branch_operator_decorator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_operator_decorator.py similarity index 96% rename from providers/standard/tests/system/standard/example_branch_operator_decorator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_branch_operator_decorator.py index 3a3b34e50d11f..d3634acb998eb 100644 --- a/providers/standard/tests/system/standard/example_branch_operator_decorator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_branch_operator_decorator.py @@ -140,9 +140,3 @@ def some_venv_task(): # Label is optional here, but it can help identify more complex branches random_choice_venv >> Label(option) >> t >> join_venv - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_external_task_child_deferrable.py b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_child_deferrable.py similarity index 87% rename from providers/standard/tests/system/standard/example_external_task_child_deferrable.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_external_task_child_deferrable.py index 1da360b57b56d..c1b8f85b4213f 100644 --- a/providers/standard/tests/system/standard/example_external_task_child_deferrable.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_child_deferrable.py @@ -32,9 +32,3 @@ task_id="child_task", bash_command="echo 1; sleep 1; echo 2; sleep 2; echo 3; sleep 3", ) - - -from tests_common.test_utils.system_tests import get_test_run - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_external_task_marker_dag.py b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py similarity index 94% rename from providers/standard/tests/system/standard/example_external_task_marker_dag.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py index d310f369611bf..b8fad182549f1 100644 --- a/providers/standard/tests/system/standard/example_external_task_marker_dag.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_marker_dag.py @@ -96,9 +96,3 @@ child_task3 = EmptyOperator(task_id="child_task3") child_task1 >> child_task2 >> child_task3 - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(parent_dag) diff --git a/providers/standard/tests/system/standard/example_external_task_parent_deferrable.py b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_parent_deferrable.py similarity index 92% rename from providers/standard/tests/system/standard/example_external_task_parent_deferrable.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_external_task_parent_deferrable.py index 090522fe92413..fcfc8b7dac3da 100644 --- a/providers/standard/tests/system/standard/example_external_task_parent_deferrable.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_external_task_parent_deferrable.py @@ -62,9 +62,3 @@ # This test needs watcher in order to properly mark success/failure # when "teardown" task with trigger rule is part of the DAG list(dag.tasks) >> watcher() - - -from tests_common.test_utils.system_tests import get_test_run - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_latest_only.py b/providers/standard/src/airflow/providers/standard/example_dags/example_latest_only.py similarity index 88% rename from providers/standard/tests/system/standard/example_latest_only.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_latest_only.py index 983db906bdb5b..745100def2af2 100644 --- a/providers/standard/tests/system/standard/example_latest_only.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_latest_only.py @@ -38,9 +38,3 @@ task1 = EmptyOperator(task_id="task1") latest_only >> task1 - - -from tests_common.test_utils.system_tests import get_test_run - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_python_decorator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_python_decorator.py similarity index 95% rename from providers/standard/tests/system/standard/example_python_decorator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_python_decorator.py index 8b26d94842632..ac9938d92eac2 100644 --- a/providers/standard/tests/system/standard/example_python_decorator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_python_decorator.py @@ -130,9 +130,3 @@ def callable_external_python(): example_dag = example_python_decorator() - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(example_dag) diff --git a/providers/standard/tests/system/standard/example_python_operator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_python_operator.py similarity index 96% rename from providers/standard/tests/system/standard/example_python_operator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_python_operator.py index 27ca2db12e995..18aa8f207e3b0 100644 --- a/providers/standard/tests/system/standard/example_python_operator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_python_operator.py @@ -145,9 +145,3 @@ def callable_external_python(): # [END howto_operator_external_python] run_this >> external_python_task >> virtualenv_task - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_sensor_decorator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_sensor_decorator.py similarity index 90% rename from providers/standard/tests/system/standard/example_sensor_decorator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_sensor_decorator.py index eaceebab9f387..64ea80400ceb8 100644 --- a/providers/standard/tests/system/standard/example_sensor_decorator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_sensor_decorator.py @@ -64,9 +64,3 @@ def dummy_operator() -> None: # [END dag_invocation] # [END tutorial] - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_sensors.py b/providers/standard/src/airflow/providers/standard/example_dags/example_sensors.py similarity index 95% rename from providers/standard/tests/system/standard/example_sensors.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_sensors.py index b5ea2f458fd94..5ec33bad51bf5 100644 --- a/providers/standard/tests/system/standard/example_sensors.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_sensors.py @@ -130,9 +130,3 @@ def failure_callable(): t8 >> tx [t9, t10] >> tx t11 >> tx - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_short_circuit_decorator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_short_circuit_decorator.py similarity index 92% rename from providers/standard/tests/system/standard/example_short_circuit_decorator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_short_circuit_decorator.py index 93b32a924502d..714325b1739d2 100644 --- a/providers/standard/tests/system/standard/example_short_circuit_decorator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_short_circuit_decorator.py @@ -58,9 +58,3 @@ def check_condition(condition): example_dag = example_short_circuit_decorator() - - -from tests_common.test_utils.system_tests import get_test_run # noqa: E402 - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(example_dag) diff --git a/providers/standard/tests/system/standard/example_short_circuit_operator.py b/providers/standard/src/airflow/providers/standard/example_dags/example_short_circuit_operator.py similarity index 92% rename from providers/standard/tests/system/standard/example_short_circuit_operator.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_short_circuit_operator.py index 892be8934ae3a..7f2b8ec39af83 100644 --- a/providers/standard/tests/system/standard/example_short_circuit_operator.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_short_circuit_operator.py @@ -64,9 +64,3 @@ chain(task_1, [task_2, short_circuit], [task_3, task_4], [task_5, task_6], task_7) # [END howto_operator_short_circuit_trigger_rules] - - -from tests_common.test_utils.system_tests import get_test_run - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/example_trigger_controller_dag.py b/providers/standard/src/airflow/providers/standard/example_dags/example_trigger_controller_dag.py similarity index 90% rename from providers/standard/tests/system/standard/example_trigger_controller_dag.py rename to providers/standard/src/airflow/providers/standard/example_dags/example_trigger_controller_dag.py index 3a85fb7e0aff1..8ca49e34b3dcd 100644 --- a/providers/standard/tests/system/standard/example_trigger_controller_dag.py +++ b/providers/standard/src/airflow/providers/standard/example_dags/example_trigger_controller_dag.py @@ -44,9 +44,3 @@ ) # [END howto_operator_trigger_dagrun] - - -from tests_common.test_utils.system_tests import get_test_run - -# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest) -test_run = get_test_run(dag) diff --git a/providers/standard/tests/system/standard/sql/__init__.py b/providers/standard/src/airflow/providers/standard/example_dags/sql/__init__.py similarity index 100% rename from providers/standard/tests/system/standard/sql/__init__.py rename to providers/standard/src/airflow/providers/standard/example_dags/sql/__init__.py diff --git a/providers/standard/tests/system/standard/sql/sample.sql b/providers/standard/src/airflow/providers/standard/example_dags/sql/sample.sql similarity index 100% rename from providers/standard/tests/system/standard/sql/sample.sql rename to providers/standard/src/airflow/providers/standard/example_dags/sql/sample.sql diff --git a/providers/standard/tests/system/__init__.py b/providers/standard/tests/system/__init__.py deleted file mode 100644 index e8fd22856438c..0000000000000 --- a/providers/standard/tests/system/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore