Files
Jinguang Dong 932a68b33e Add SPDX license standardization for reference data generation
- Add spdx_converter.py to convert license names to SPDX standard identifiers
- Add generate_reference_data.py to generate reference_data.json from README.OpenSource files
- Update data/spdx.json with latest SPDX license list (712 licenses)
- Update test/reference_data.json with SPDX-standardized license identifiers
- Add unit tests for SPDX converter (10 test methods, 28 subtests)
- Add Python project configuration files (pyproject.toml, requirements.txt)

Features:
- Converts license variants like "MIT License" -> "MIT", "GPL-2.0" -> "GPL-2.0-only"
- Handles WITH exception format (e.g., "Apache-2.0 WITH LLVM-exception")
- Supports multiple license separators (;, /, ,, or, OR)
- Validates all generated license identifiers against SPDX standard

All license identifiers in reference_data.json are now valid SPDX standard.

Signed-off-by: Jinguang Dong <dongjinguang@huawei.com>
2026-02-10 18:03:16 +08:00

24 lines
555 B
Python

"""
Pytest configuration and shared fixtures for OpenHarmony open source tools tests.
"""
import sys
from pathlib import Path
import pytest
# Add src directory to Python path for imports
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
@pytest.fixture
def sample_reference_data():
"""Sample reference data for testing OpenSourceValidator."""
return [
{
"Name": "Software A",
"License": "MIT",
"Version Number": "1.0.0",
"Upstream URL": "https://example.com"
}
]