Skip to content

Add GitHub Actions workflow for automated Python testing#34

Merged
barrald merged 1 commit intomasterfrom
copilot/fix-6560d720-7fce-4397-895d-097bb0f0dca6
Jul 11, 2025
Merged

Add GitHub Actions workflow for automated Python testing#34
barrald merged 1 commit intomasterfrom
copilot/fix-6560d720-7fce-4397-895d-097bb0f0dca6

Conversation

Copy link
Contributor

Copilot AI commented Jul 11, 2025

This PR adds automated testing infrastructure to the repository by creating a GitHub Actions workflow that validates the test_get_date_range.py test suite.

Changes Made

1. Created GitHub Actions Workflow

  • Added .github/workflows/python-tests.yml with the following configuration:
    • Triggers: Runs on pushes and pull requests targeting the main branch
    • Environment: Uses ubuntu-latest runner with Python 3.9
    • Dependencies: Upgrades pip and installs from requirements.txt
    • Test Execution: Navigates to tests/ directory and runs test_get_date_range.py with proper PYTHONPATH configuration

2. Fixed Test File Indentation

  • Corrected inconsistent indentation in tests/test_get_date_range.py (converted tabs to spaces)
  • This was necessary to make the test file executable, as Python was throwing TabError due to mixed tab/space indentation

Workflow Details

The workflow follows the exact specifications requested:

name: Python Tests

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python 3.9
      uses: actions/setup-python@v4
      with:
        python-version: "3.9"
    - name: Upgrade pip
      run: python -m pip install --upgrade pip
    - name: Install dependencies
      run: pip install -r requirements.txt
    - name: Run tests
      run: |
        cd tests
        PYTHONPATH=..:$PYTHONPATH python -m unittest test_get_date_range.py

Testing

All three test cases in test_get_date_range.py now pass successfully:

  • test_get_date_range_requires_datetime - Validates type checking
  • test_get_date_range_default - Tests default 12-hour buffer behavior
  • test_get_date_range - Tests custom 24-hour buffer behavior

The workflow ensures compatibility with the current implementation and will automatically validate future changes to the get_date_range function.

This pull request was created as a result of the following prompt from Copilot chat.

Create a GitHub Actions workflow file named .github/workflows/python-tests.yml to automate the testing process for the repository barrald/strava-uploader.

Requirements:

  • Trigger:

    • Run the workflow on pull requests and pushes targeting the main branch.
  • Environment Setup:

    • Use ubuntu-latest as the runner.
    • Set up Python version 3.9.
  • Dependencies:

    • Upgrade pip.
    • Install dependencies from requirements.txt.
  • Test Execution:

    • Navigate to the tests directory.
    • Use the PYTHONPATH=..:$PYTHONPATH environment variable.
    • Run the test_get_date_range.py file using the unittest framework.

Expected Outcome:

The workflow should validate the test_get_date_range.py suite's correctness and ensure compatibility with the current implementation of the repository.

This workflow should be committed into the .github/workflows/python-tests.yml file.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@barrald barrald marked this pull request as ready for review July 11, 2025 15:50
@barrald barrald requested a review from Copilot July 11, 2025 15:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@barrald barrald merged commit 5b85790 into master Jul 11, 2025
1 check passed
@barrald barrald deleted the copilot/fix-6560d720-7fce-4397-895d-097bb0f0dca6 branch July 11, 2025 15:51
Copilot AI changed the title [WIP] Add GitHub Actions Workflow for Python Tests Add GitHub Actions workflow for automated Python testing Jul 11, 2025
Copilot AI requested a review from barrald July 11, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants