Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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

- 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:
name: pytest-results-${{ matrix.python-version }}
path: |
junit.xml
htmlcov/
4 changes: 2 additions & 2 deletions src/jrdev/commands/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/jrdev/file_operations/confirmation.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down