Skip to content

Commit

Permalink
Add CI workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Hale committed Jan 26, 2024
1 parent 03a6080 commit 2c2e042
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI

on: push

jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Run tests
run: |
export PYTHONPATH=src/modules
python -m unittest discover tests
10 changes: 7 additions & 3 deletions tests/test_tariff.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@


class TestTariff(unittest.TestCase):
def test(self):
def testCalculateTariff(self):
config = {"tariff_name": "Test",
"tariff_provider": "Test",
"tariff_breaks" : [0.1, 0.2, 0.3]}
"tariff_breaks" : [0.1, 0.2, 0.3],
"tariff_pricing": ["average", "average", "average", "average"]}
day = datetime.date(2023, 12, 27)
rates = itertools.chain(prev_rates, today_rates, next_rates)
rates = tariff.Rates()
rates.previous_day = prev_rates
rates.current_day = today_rates
rates.next_day = next_rates
data = tariff.calculate_tariff_data(config, day, rates)
print(json.dumps(data))

0 comments on commit 2c2e042

Please sign in to comment.