From 1cc52b6c55d66828524c0b0d6a256c2314d00117 Mon Sep 17 00:00:00 2001 From: Alp Erkent Date: Wed, 16 Apr 2025 15:50:19 -0400 Subject: [PATCH 1/5] Refactor GitHub Actions workflow: update job configurations to use matrix strategy for OS and Python versions --- .github/workflows/test.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7492898..c16b670 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,7 +8,12 @@ on: jobs: unit: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: [3.12, 3.13] steps: - uses: actions/checkout@v4 - name: Install uv @@ -18,7 +23,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version-file: pyproject.toml + python-version: ${{ matrix.python-version }} - name: Install the project run: uv sync --only-dev - name: Run tests From 3606c81483b0c68cb9e7e2d1fc596e32326d0df2 Mon Sep 17 00:00:00 2001 From: Alp Erkent Date: Wed, 16 Apr 2025 15:58:25 -0400 Subject: [PATCH 2/5] Fix GitHub Actions workflow: specify shell for test execution step --- .github/workflows/test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c16b670..3cd25d1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -28,7 +28,8 @@ jobs: run: uv sync --only-dev - name: Run tests id: run-tests - run: > + shell: bash + run: | uv run pytest \ --junitxml=pytest.xml \ --cov-report=term-missing:skip-covered \ From a2eea6ae63bf9ea5d9e1ac0ef48a481bdb78a78b Mon Sep 17 00:00:00 2001 From: Alp Erkent Date: Wed, 16 Apr 2025 16:09:10 -0400 Subject: [PATCH 3/5] Refactor test cases in test_reader.py: use re.escape for filename handling to fix Windows file path issues --- tests/unit/test_reader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_reader.py b/tests/unit/test_reader.py index 87c23c2..14ba00d 100644 --- a/tests/unit/test_reader.py +++ b/tests/unit/test_reader.py @@ -1,6 +1,7 @@ """Test cases for reader.py functions.""" import pathlib +import re import pandas as pd import pytest @@ -33,7 +34,7 @@ def test_parse_filename_valid(sample_data: pathlib.Path) -> None: ) def test_parse_filename_invalid(invalid_filename: str) -> None: """Test that invalid filenames raise a ValueError.""" - filename = invalid_filename.replace("[", "\\[").replace("]", "\\]") + filename = re.escape(invalid_filename) with pytest.raises( ValueError, match=f"Filename does not match expected pattern: {filename}", @@ -69,6 +70,6 @@ def test_load_spiral(sample_data: pathlib.Path) -> None: def test_load_spiral_invalid_extension(sample_data: pathlib.Path) -> None: """Test that loading a non-CSV file raises an error.""" invalid_file = sample_data.with_suffix(".txt") - filename = invalid_file.as_posix().replace("[", "\\[").replace("]", "\\]") + filename = re.escape(invalid_file.as_posix()) with pytest.raises(IOError, match=f"Error reading file {filename}"): reader.load_spiral(invalid_file) From f92b672e75209615a7dfd1e2230f21fccfa87722 Mon Sep 17 00:00:00 2001 From: Alp Erkent Date: Wed, 16 Apr 2025 16:23:46 -0400 Subject: [PATCH 4/5] Fix test_load_spiral_invalid_extension: update filename handling to ensure native path format for each OS --- tests/unit/test_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_reader.py b/tests/unit/test_reader.py index 14ba00d..16b9358 100644 --- a/tests/unit/test_reader.py +++ b/tests/unit/test_reader.py @@ -70,6 +70,6 @@ def test_load_spiral(sample_data: pathlib.Path) -> None: def test_load_spiral_invalid_extension(sample_data: pathlib.Path) -> None: """Test that loading a non-CSV file raises an error.""" invalid_file = sample_data.with_suffix(".txt") - filename = re.escape(invalid_file.as_posix()) + filename = re.escape(str(invalid_file)) with pytest.raises(IOError, match=f"Error reading file {filename}"): reader.load_spiral(invalid_file) From 170df30051a3393c36f4ed225e1cd670270e3fb8 Mon Sep 17 00:00:00 2001 From: Alp Erkent Date: Thu, 17 Apr 2025 12:54:31 -0400 Subject: [PATCH 5/5] Refactor GitHub Actions workflow: add dependency resolution for unit tests --- .github/workflows/test.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3cd25d1..3f7de14 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,12 +8,13 @@ on: jobs: unit: - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: [3.12, 3.13] + dependency-mode: [lowest-direct, highest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Install uv @@ -25,7 +26,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install the project - run: uv sync --only-dev + run: uv sync --only-dev --resolution=${{ matrix.dependency-mode }} - name: Run tests id: run-tests shell: bash