From 5188dba011d26ca8e00ac8f85f3e21aeeebf9a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Luna?= Date: Wed, 11 Dec 2024 05:05:13 -0300 Subject: [PATCH] fix: set executable permissions and resolve issues in test_generate_internal_api_rst.py This PR fixes two issues: Sets the correct executable permissions for the generate_internal_api_rst.py script to ensure it runs properly in the CI/CD pipeline. Resolves issues in test_generate_internal_api_rst.py. Changes: Set executable permissions for generate_internal_api_rst.py. Updated test_generate_internal_api_rst.py to resolve related issues. Testing: Ensure the script runs without permission errors in the CI/CD pipeline. Verify that tests pass successfully. --- .../cicd/scripts/generate_internal_api_rst.py | 15 +-------------- .../test_generate_internal_api_rst.py | 12 ++++-------- 2 files changed, 5 insertions(+), 22 deletions(-) mode change 100644 => 100755 cicd_utils/cicd/scripts/generate_internal_api_rst.py mode change 100644 => 100755 tests/cicd_utils/test_scripts/test_generate_internal_api_rst.py diff --git a/cicd_utils/cicd/scripts/generate_internal_api_rst.py b/cicd_utils/cicd/scripts/generate_internal_api_rst.py old mode 100644 new mode 100755 index b4954a6..365b440 --- a/cicd_utils/cicd/scripts/generate_internal_api_rst.py +++ b/cicd_utils/cicd/scripts/generate_internal_api_rst.py @@ -21,9 +21,7 @@ PATH_TO_SRC = PATH_ROOT_DIR / "src/ridgeplot" PATH_TO_DOCS = PATH_ROOT_DIR / "docs/api/internal" -# Descriptions for all modules MODULE_DESCRIPTIONS = { - # Main modules "ridgeplot": "Main ridgeline plotting module.", "ridgeplot._ridgeplot": "Core implementation of ridgeline plots.", "ridgeplot._figure_factory": "Factory functions for creating ridgeline plots.", @@ -33,22 +31,16 @@ "ridgeplot._utils": "General utility functions.", "ridgeplot._missing": "Missing value handling utilities.", "ridgeplot._version": "Version information.", - - # Color module and submodules "ridgeplot._color": "Color management and utilities.", "ridgeplot._color.colorscale": "Continuous colorscale generation and handling.", "ridgeplot._color.css_colors": "Standard CSS color definitions and mappings.", "ridgeplot._color.interpolation": "Color interpolation and gradient utilities.", "ridgeplot._color.utils": "Color manipulation and conversion functions.", - - # Object module and submodules "ridgeplot._obj": "Object-oriented implementations.", "ridgeplot._obj.traces": "Trace implementations for different plot types.", "ridgeplot._obj.traces.area": "Area trace for density visualizations.", "ridgeplot._obj.traces.bar": "Bar trace for histogram visualizations.", "ridgeplot._obj.traces.base": "Base classes for trace implementations.", - - # Vendor modules "ridgeplot._vendor": "Third-party vendored utilities.", "ridgeplot._vendor.more_itertools": "Additional iteration utilities.", } @@ -163,21 +155,16 @@ def clean_directory(path: Path) -> None: def main() -> None: """Generate RST files for all internal modules.""" - # Clean up existing directories for dir_name in ['color', 'obj', 'vendor', '_color', '_obj', '_vendor']: dir_path = PATH_TO_DOCS / dir_name if dir_path.exists(): clean_directory(dir_path) dir_path.rmdir() - - # Clean up RST files in root + for rst_file in PATH_TO_DOCS.glob('*.rst'): rst_file.unlink() - # Create output directory PATH_TO_DOCS.mkdir(parents=True, exist_ok=True) - - # Generate new files modules = [name for name, _ in find_internal_modules(PATH_TO_SRC)] hierarchy = organize_modules(modules) diff --git a/tests/cicd_utils/test_scripts/test_generate_internal_api_rst.py b/tests/cicd_utils/test_scripts/test_generate_internal_api_rst.py old mode 100644 new mode 100755 index 4d3afa9..bc7716e --- a/tests/cicd_utils/test_scripts/test_generate_internal_api_rst.py +++ b/tests/cicd_utils/test_scripts/test_generate_internal_api_rst.py @@ -8,16 +8,12 @@ import pytest -# Import script directly +from generate_internal_api_rst import generate_module_rst, organize_modules + +# Mueve esta línea después de las importaciones SCRIPT_PATH = Path(__file__).parents[3] / "cicd_utils/cicd/scripts/generate_internal_api_rst.py" sys.path.append(str(SCRIPT_PATH.parent)) -from generate_internal_api_rst import ( - generate_module_rst, - organize_modules, -) - - def test_organize_modules() -> None: """Test basic module organization.""" modules = ["_color.utils", "_color.css_colors", "_hist", "_kde"] @@ -36,4 +32,4 @@ def test_generate_module_rst() -> None: assert "ridgeplot._color" in content assert ".. toctree::" in content assert "utils" in content - assert "css_colors" in content \ No newline at end of file + assert "css_colors" in content