diff --git a/manage.py b/manage.py index 7ed85eb..34287c5 100755 --- a/manage.py +++ b/manage.py @@ -143,7 +143,12 @@ def cmd_sources(): print("Sources Status") print("=" * 60 + "\n") - import yaml + try: + import yaml + except ImportError: + print("❌ Error: PyYAML is not installed") + print("Install it with: pip install pyyaml") + return 1 sources_dir = REPO_ROOT / "sources" categories = ["gost", "iso", "analogs", "brands", "skf"] diff --git a/requirements.txt b/requirements.txt index 5b1f97b..3d16dc3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ pytest>=7.4.0 +pyyaml>=6.0 diff --git a/scripts/generate_sources_table.py b/scripts/generate_sources_table.py index 709476c..98758c3 100644 --- a/scripts/generate_sources_table.py +++ b/scripts/generate_sources_table.py @@ -5,6 +5,9 @@ Generate sources table for SOURCES.md. This script reads all meta.yaml files from sources/ subdirectories and generates a markdown table with source information. +Requirements: + - PyYAML (install with: pip install pyyaml) + Usage: python scripts/generate_sources_table.py [--output SOURCES.md] @@ -14,10 +17,17 @@ Examples: """ import argparse -import yaml +import sys from pathlib import Path from datetime import datetime +try: + import yaml +except ImportError: + print("❌ Error: PyYAML is not installed") + print("Install it with: pip install pyyaml") + sys.exit(1) + def load_sources_metadata(sources_dir): """Load all source metadata from meta.yaml files.""" diff --git a/tests/test_schema_validation.py b/tests/test_schema_validation.py index 8818674..64cab90 100644 --- a/tests/test_schema_validation.py +++ b/tests/test_schema_validation.py @@ -30,7 +30,7 @@ class TestSchemas(unittest.TestCase): self.assertTrue(self.schemas_dir.is_dir(), "schemas/ should be a directory") def test_all_schema_files_valid_json(self): - """Test that all .yaml schema files contain valid JSON.""" + """Test that all .yaml schema files contain valid JSON format.""" schema_files = list(self.schemas_dir.glob("*.yaml")) self.assertGreater(len(schema_files), 0, "Should have at least one schema file") @@ -38,6 +38,7 @@ class TestSchemas(unittest.TestCase): with self.subTest(schema=schema_file.name): with open(schema_file, 'r', encoding='utf-8') as f: try: + # Note: These .yaml files actually contain JSON format data = json.load(f) self.assertIsInstance(data, dict, f"{schema_file.name} should contain a JSON object") except json.JSONDecodeError as e: