ashb commented on code in PR #51153: URL: https://github.com/apache/airflow/pull/51153#discussion_r2132107407
########## task-sdk/tests/test_docs_inventory.py: ########## @@ -0,0 +1,82 @@ +# 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. +from __future__ import annotations + +import sys +from pathlib import Path + +# Add the SDK src directory to sys.path so that importlib loads our airflow.sdk module +sys.path.insert(0, str(Path(__file__).parent.parent / "src")) +import importlib +import shutil +import subprocess +import zlib +from pathlib import Path + +import pytest + + +def read_inventory(inv_path: Path): + """ + Read a Sphinx objects.inv inventory file and return a mapping of documented full names to their entries. + """ + inv: dict[str, tuple[str, str, str]] = {} + with inv_path.open("rb") as f: + f.readline() + f.readline() + f.readline() + f.readline() + data = zlib.decompress(f.read()).decode("utf-8").splitlines() + for line in data: + if not line.strip(): + continue + parts = line.split(None, 4) + if len(parts) != 5: + continue + name, domain_role, prio, location, dispname = parts + inv[name] = (domain_role, location, dispname) + return inv + + [email protected]( + shutil.which("sphinx-build") is None, reason="sphinx-build not available, skipping docs inventory test" +) Review Comment: This will fail if docs aren't built too right -- should it also test if the inventory file exists? Do we somehow run this specific test as part of the docs build pipeline? Surely it can't pass via the normal CI test pipeline? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
