Skip to content

Commit

Permalink
Add __init__.py files to fix import issues when running pytest
Browse files Browse the repository at this point in the history
Add test.yml file for automatically running unit tests in GitHub actions

Cleanup test.py imports
  • Loading branch information
cparks1 committed May 12, 2024
1 parent f778b7e commit 83b57f1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Python Unit Tests

on:
push: # Run on every push event

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
steps:
- uses: actions/checkout@v3 # Checkout code from repository
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Run tests
run: |
python -m pytest test/tests.py
Empty file added __init__.py
Empty file.
Empty file added test/__init__.py
Empty file.
13 changes: 11 additions & 2 deletions test/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
from datetime import datetime, timezone, timedelta
from datetime import (
datetime,
timezone,
timedelta
)
import pytest

from main import app, calculate_timezone_offset, is_valid_timezone_format, datetime_to_requested_string_format
from main import (
app,
calculate_timezone_offset,
is_valid_timezone_format,
datetime_to_requested_string_format
)


@pytest.fixture()
Expand Down

0 comments on commit 83b57f1

Please sign in to comment.