fix: name a missing data directory registry

This commit is contained in:
Abdessamad Derraz committed 2026-11-06 03:27:36 +01:00
1 parent f96e7c10f4
commit 74055a9f31
3 files changed
+13 -3

No files matched your search

+5 -1
View File
@@ -15,13 +15,14 @@ from __future__ import annotations
import argparse
import json
import logging
import os
import subprocess
import sys
import urllib.error
import urllib.parse
import urllib.request
from pathlib import Path
from common import yaml_load
from common import InputMissing, yaml_load
log = logging.getLogger(__name__)
@@ -194,6 +195,9 @@ def main() -> None:
help="the data directory registry to check (default: %(default)s)",
)
args = parser.parse_args()
# Read after the buildbot answered, a mistyped path ended on a trace.
if not os.path.isfile(args.registry):
raise InputMissing(f"Registry not found: {args.registry}")
report = check(args.registry)
+2 -2
View File
@@ -27,7 +27,7 @@ import zipfile
from collections.abc import Iterator
from pathlib import Path
from artifacts import file_lock as _file_lock, set_plain_mode
from common import github_token, platform_arg, require_platform, suggest_names, yaml_load
from common import InputMissing, github_token, platform_arg, require_platform, suggest_names, yaml_load
try:
import yaml
@@ -53,7 +53,7 @@ def load_registry(registry_path: str = DEFAULT_REGISTRY) -> dict[str, dict]:
raise ImportError("PyYAML required: pip install pyyaml")
path = Path(registry_path)
if not path.exists():
raise FileNotFoundError(f"Registry not found: {registry_path}")
raise InputMissing(f"Registry not found: {registry_path}")
with open(path) as f:
data = yaml_load(f) or {}
return data.get("data_directories", {})
+6
View File
@@ -397,6 +397,12 @@ class AMissingInputFileIsNamed(unittest.TestCase):
"ERROR: --from-md5-file nosuch.txt: No such file or directory",
)
def test_a_missing_data_directory_registry_is_named(self):
for argv in (["scripts/refresh_data_dirs.py", "--registry", "nosuch.yml", "--dry-run"],
["scripts/check_buildbot_system.py", "--registry", "nosuch.yml"]):
with self.subTest(script=argv[0]):
self._refused(argv, "ERROR: Registry not found: nosuch.yml")
class StrictVerifyFailsOnACriticalMiss(unittest.TestCase):
"""verify exited 0 with a required file missing on an md5 platform, so