From de65423c28c9a71e24f440b276cae94eb958e8c6 Mon Sep 17 00:00:00 2001 From: presstab Date: Wed, 13 Aug 2025 09:54:14 -0600 Subject: [PATCH 1/4] ci: add pytest workflow for push and pull request events --- .github/workflows/pytest.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..829f75c --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,13 @@ +name: Pytest +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - run: pip install pytest + - run: pytest tests/ \ No newline at end of file From 886ffc9ebfb0ca11560546effac203304e0e75cc Mon Sep 17 00:00:00 2001 From: presstab Date: Wed, 13 Aug 2025 10:00:01 -0600 Subject: [PATCH 2/4] ci: enhance pytest workflow with matrix testing and coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Python 3.9–3.12 matrix strategy - Cache pip dependencies for faster runs - Install project deps and pytest-cov - Generate XML/HTML coverage reports - Upload artifacts for all outcomes --- .github/workflows/pytest.yml | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 829f75c..1ef7eac 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,13 +1,38 @@ -name: Pytest +name: Pytest Tests + on: [push, pull_request] jobs: test: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest pytest-cov + + - name: Run tests + run: | + pytest tests/ -v --cov=src --cov-report=xml --cov-report=html + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() with: - python-version: '3.11' - - run: pip install pytest - - run: pytest tests/ \ No newline at end of file + name: pytest-results-${{ matrix.python-version }} + path: | + junit.xml + htmlcov/ \ No newline at end of file From a63e9dff54a875f9e168a53250dadca9b9e10183 Mon Sep 17 00:00:00 2001 From: presstab Date: Wed, 13 Aug 2025 10:17:18 -0600 Subject: [PATCH 3/4] refactor: replace union operator with typing.Union for compatibility - Updated type hints to use Union[list, str] instead of list | str for broader Python version support - Changed return type annotation from Tuple[str, str] to Tuple[str, Optional[str]] to accurately reflect that the second element can be None --- src/jrdev/file_operations/confirmation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jrdev/file_operations/confirmation.py b/src/jrdev/file_operations/confirmation.py index 3f28c35..f5d3681 100644 --- a/src/jrdev/file_operations/confirmation.py +++ b/src/jrdev/file_operations/confirmation.py @@ -1,5 +1,5 @@ import os -from typing import Optional, Tuple +from typing import Optional, Tuple, Union from jrdev.file_operations.diff_markup import apply_diff_markup, remove_diff_markup from jrdev.file_operations.diff_utils import create_diff @@ -91,7 +91,7 @@ async def write_file_with_confirmation(app, filepath: str, content: str): return 'no', None -async def write_with_confirmation(app, filepath: str, content: list | str) -> Tuple[str, str]: +async def write_with_confirmation(app, filepath: str, content: Union[list, str]) -> Tuple[str, Optional[str]]: if isinstance(content, list): content_str = ''.join(content) else: From bd86039b767735ab87d2fac6224230d9eb95fc29 Mon Sep 17 00:00:00 2001 From: presstab Date: Wed, 13 Aug 2025 10:23:47 -0600 Subject: [PATCH 4/4] refactor: replace union operator with typing.Union for Python 3.9 compatibility --- src/jrdev/commands/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jrdev/commands/model.py b/src/jrdev/commands/model.py index bf77499..d9c7397 100644 --- a/src/jrdev/commands/model.py +++ b/src/jrdev/commands/model.py @@ -4,7 +4,7 @@ Model command implementation for the JrDev terminal. Manages the user's list of available models and the active chat model. """ -from typing import Any, List +from typing import Any, List, Union from jrdev.ui.ui import PrintType from jrdev.utils.string_utils import is_valid_context_window, is_valid_cost, is_valid_name @@ -22,7 +22,7 @@ def _parse_bool(val: str) -> bool: # pylint: disable=too-many-return-statements -def _parse_model_arguments(app, args: List[str], start_idx: int) -> dict | None: +def _parse_model_arguments(app, args: List[str], start_idx: int) -> Union[dict, None]: """Parse and validate model arguments starting from given index.""" name = args[start_idx] provider = args[start_idx + 1]