Skip to content

Commit 13c6020

Browse files
authored
Fix reading number of dags from direct system providers path (apache#50843)
The original PR apache#49978 that fixed generation of proper documentation for standard provider examples added retrieval of the path by checking import location for the standard provider. Instead we are now using direct path to the provider.
1 parent 62678f9 commit 13c6020

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_report.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
from airflow.utils.file import list_py_file_paths
2525

26-
import system.standard
26+
from tests_common.pytest_plugin import AIRFLOW_ROOT_PATH
2727
from tests_common.test_utils.config import conf_vars
2828
from tests_common.test_utils.db import clear_db_dags, parse_and_sync_to_db
2929

@@ -34,14 +34,18 @@
3434
TEST_DAG_FOLDER_INVALID = "/invalid/path"
3535
TEST_DAG_FOLDER_INVALID_2 = "/root/airflow/tests/dags/"
3636

37+
STANDARD_PROVIDER_SYSTEM_TESTS_PATH = (
38+
AIRFLOW_ROOT_PATH / "providers" / "standard" / "tests" / "system" / "standard"
39+
)
40+
3741

3842
def get_corresponding_dag_file_count(dir: str, include_examples: bool = True) -> int:
3943
from airflow import example_dags
4044

4145
return (
4246
len(list_py_file_paths(directory=dir))
4347
+ (len(list_py_file_paths(next(iter(example_dags.__path__)))) if include_examples else 0)
44-
+ (len(list_py_file_paths(next(iter(system.standard.__path__)))) if include_examples else 0)
48+
+ (len(list_py_file_paths(STANDARD_PROVIDER_SYSTEM_TESTS_PATH.as_posix())) if include_examples else 0)
4549
)
4650

4751

0 commit comments

Comments
 (0)