This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v2-11-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v2-11-test by this push:
new 1a93f4040e0 Also remove provider module tests
1a93f4040e0 is described below
commit 1a93f4040e006ae4e9351db0a79718d434ce321c
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Jun 23 18:32:59 2025 +0200
Also remove provider module tests
---
tests/always/test_project_structure.py | 146 ---------------------------------
1 file changed, 146 deletions(-)
diff --git a/tests/always/test_project_structure.py
b/tests/always/test_project_structure.py
index 15813ca9ca2..b2e01d95160 100644
--- a/tests/always/test_project_structure.py
+++ b/tests/always/test_project_structure.py
@@ -53,152 +53,6 @@ class TestProjectStructure:
if content.find(bytes(pattern, "utf-8")) == -1:
pytest.fail(f"File {filename} contains illegal pattern -
{pattern}")
- def test_providers_modules_should_have_tests(self):
- """
- Assert every module in /airflow/providers has a corresponding test_
file in tests/airflow/providers.
- """
- # The test below had a but for quite a while and we missed a lot of
modules to have tess
- # We should make sure that one goes to 0
- OVERLOOKED_TESTS = [
- "tests/providers/amazon/aws/executors/batch/test_boto_schema.py",
-
"tests/providers/amazon/aws/executors/batch/test_batch_executor_config.py",
- "tests/providers/amazon/aws/executors/batch/test_utils.py",
- "tests/providers/amazon/aws/executors/ecs/test_boto_schema.py",
-
"tests/providers/amazon/aws/executors/ecs/test_ecs_executor_config.py",
- "tests/providers/amazon/aws/executors/ecs/test_utils.py",
-
"tests/providers/amazon/aws/executors/utils/test_base_config_keys.py",
- "tests/providers/amazon/aws/operators/test_emr.py",
- "tests/providers/amazon/aws/operators/test_sagemaker.py",
- "tests/providers/amazon/aws/sensors/test_emr.py",
- "tests/providers/amazon/aws/sensors/test_sagemaker.py",
- "tests/providers/amazon/aws/test_exceptions.py",
- "tests/providers/amazon/aws/triggers/test_step_function.py",
- "tests/providers/amazon/aws/utils/test_rds.py",
- "tests/providers/amazon/aws/utils/test_sagemaker.py",
- "tests/providers/amazon/aws/waiters/test_base_waiter.py",
- "tests/providers/apache/cassandra/hooks/test_cassandra.py",
- "tests/providers/apache/drill/operators/test_drill.py",
- "tests/providers/apache/druid/operators/test_druid_check.py",
- "tests/providers/apache/hdfs/hooks/test_hdfs.py",
- "tests/providers/apache/hdfs/log/test_hdfs_task_handler.py",
- "tests/providers/apache/hdfs/sensors/test_hdfs.py",
- "tests/providers/apache/hive/plugins/test_hive.py",
- "tests/providers/celery/executors/test_celery_executor_utils.py",
- "tests/providers/celery/executors/test_default_celery.py",
-
"tests/providers/cncf/kubernetes/backcompat/test_backwards_compat_converters.py",
-
"tests/providers/cncf/kubernetes/executors/test_kubernetes_executor_types.py",
-
"tests/providers/cncf/kubernetes/executors/test_kubernetes_executor_utils.py",
- "tests/providers/cncf/kubernetes/operators/test_kubernetes_pod.py",
- "tests/providers/cncf/kubernetes/test_k8s_model.py",
- "tests/providers/cncf/kubernetes/test_kube_client.py",
- "tests/providers/cncf/kubernetes/test_kube_config.py",
- "tests/providers/cncf/kubernetes/test_pod_generator_deprecated.py",
- "tests/providers/cncf/kubernetes/test_pod_launcher_deprecated.py",
- "tests/providers/cncf/kubernetes/test_python_kubernetes_script.py",
- "tests/providers/cncf/kubernetes/test_secret.py",
- "tests/providers/cncf/kubernetes/triggers/test_kubernetes_pod.py",
- "tests/providers/cncf/kubernetes/utils/test_delete_from.py",
-
"tests/providers/cncf/kubernetes/utils/test_k8s_hashlib_wrapper.py",
- "tests/providers/cncf/kubernetes/utils/test_xcom_sidecar.py",
- "tests/providers/databricks/hooks/test_databricks_base.py",
- "tests/providers/google/cloud/fs/test_gcs.py",
- "tests/providers/google/cloud/links/test_automl.py",
- "tests/providers/google/cloud/links/test_base.py",
- "tests/providers/google/cloud/links/test_bigquery.py",
- "tests/providers/google/cloud/links/test_bigquery_dts.py",
- "tests/providers/google/cloud/links/test_bigtable.py",
- "tests/providers/google/cloud/links/test_cloud_build.py",
- "tests/providers/google/cloud/links/test_cloud_functions.py",
- "tests/providers/google/cloud/links/test_cloud_memorystore.py",
- "tests/providers/google/cloud/links/test_cloud_sql.py",
-
"tests/providers/google/cloud/links/test_cloud_storage_transfer.py",
- "tests/providers/google/cloud/links/test_cloud_tasks.py",
- "tests/providers/google/cloud/links/test_compute.py",
- "tests/providers/google/cloud/links/test_data_loss_prevention.py",
- "tests/providers/google/cloud/links/test_datacatalog.py",
- "tests/providers/google/cloud/links/test_dataflow.py",
- "tests/providers/google/cloud/links/test_dataform.py",
- "tests/providers/google/cloud/links/test_datafusion.py",
- "tests/providers/google/cloud/links/test_dataplex.py",
- "tests/providers/google/cloud/links/test_dataprep.py",
- "tests/providers/google/cloud/links/test_dataproc.py",
- "tests/providers/google/cloud/links/test_datastore.py",
- "tests/providers/google/cloud/links/test_kubernetes_engine.py",
- "tests/providers/google/cloud/links/test_life_sciences.py",
- "tests/providers/google/cloud/links/test_mlengine.py",
- "tests/providers/google/cloud/links/test_pubsub.py",
- "tests/providers/google/cloud/links/test_spanner.py",
- "tests/providers/google/cloud/links/test_stackdriver.py",
- "tests/providers/google/cloud/links/test_vertex_ai.py",
- "tests/providers/google/cloud/links/test_workflows.py",
- "tests/providers/google/cloud/operators/vertex_ai/test_auto_ml.py",
-
"tests/providers/google/cloud/operators/vertex_ai/test_batch_prediction_job.py",
-
"tests/providers/google/cloud/operators/vertex_ai/test_custom_job.py",
- "tests/providers/google/cloud/operators/vertex_ai/test_dataset.py",
-
"tests/providers/google/cloud/operators/vertex_ai/test_endpoint_service.py",
-
"tests/providers/google/cloud/operators/vertex_ai/test_hyperparameter_tuning_job.py",
-
"tests/providers/google/cloud/operators/vertex_ai/test_model_service.py",
-
"tests/providers/google/cloud/operators/vertex_ai/test_pipeline_job.py",
- "tests/providers/google/cloud/sensors/test_dataform.py",
- "tests/providers/google/cloud/transfers/test_bigquery_to_sql.py",
- "tests/providers/google/cloud/transfers/test_presto_to_gcs.py",
- "tests/providers/google/cloud/utils/test_bigquery.py",
- "tests/providers/google/cloud/utils/test_bigquery_get_data.py",
- "tests/providers/google/cloud/utils/test_dataform.py",
- "tests/providers/google/common/links/test_storage.py",
- "tests/providers/google/common/test_consts.py",
- "tests/providers/google/test_go_module_utils.py",
- "tests/providers/microsoft/azure/operators/test_adls.py",
-
"tests/providers/microsoft/azure/transfers/test_azure_blob_to_gcs.py",
- "tests/providers/mongo/sensors/test_mongo.py",
- "tests/providers/slack/notifications/test_slack_notifier.py",
- "tests/providers/snowflake/triggers/test_snowflake_trigger.py",
- "tests/providers/yandex/hooks/test_yandexcloud_dataproc.py",
- "tests/providers/yandex/operators/test_yandexcloud_dataproc.py",
- ]
-
- # TODO: Should we extend this test to cover other directories?
- modules_files =
list(glob.glob(f"{ROOT_FOLDER}/airflow/providers/**/*.py", recursive=True))
-
- # Make path relative
- modules_files = list(os.path.relpath(f, ROOT_FOLDER) for f in
modules_files)
- # Exclude example_dags
- modules_files = list(f for f in modules_files if "/example_dags/" not
in f)
- # Exclude _vendor
- modules_files = list(f for f in modules_files if "/_vendor/" not in f)
- # Exclude __init__.py
- modules_files = list(f for f in modules_files if not
f.endswith("__init__.py"))
- # Change airflow/ to tests/
- expected_test_files = list(
- f'tests/{f.partition("/")[2]}' for f in modules_files if not
f.endswith("__init__.py")
- )
- # Add test_ prefix to filename
- expected_test_files = list(
- f'{f.rpartition("/")[0]}/test_{f.rpartition("/")[2]}'
- for f in expected_test_files
- if not f.endswith("__init__.py")
- )
-
- current_test_files =
glob.glob(f"{ROOT_FOLDER}/tests/providers/**/*.py", recursive=True)
- # Make path relative
- current_test_files = (os.path.relpath(f, ROOT_FOLDER) for f in
current_test_files)
- # Exclude __init__.py
- current_test_files = (f for f in current_test_files if not
f.endswith("__init__.py"))
-
- modules_files = set(modules_files)
- expected_test_files = set(expected_test_files) - set(OVERLOOKED_TESTS)
- current_test_files = set(current_test_files)
-
- missing_tests_files = expected_test_files -
expected_test_files.intersection(current_test_files)
-
- assert set() == missing_tests_files, "Detect missing tests in
providers module - please add tests"
-
- added_test_files = current_test_files.intersection(OVERLOOKED_TESTS)
- assert set() == added_test_files, (
- "Detect added tests in providers module - please remove the tests "
- "from OVERLOOKED_TESTS list above"
- )
-
def get_imports_from_file(filepath: str):
with open(filepath) as py_file: