From 76df6561281fdfe89e790a04aced49c8f728ef18 Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Sun, 8 Aug 2021 20:40:50 +0200 Subject: [PATCH] run tests on commit --- .github/workflows/test.yml | 15 +++++++++++++++ requirements.txt | 3 ++- tests/{test_data => }/__init__.py | 0 tests/data/__init__.py | 0 tests/{test_data => data}/test_regexes.py | 0 tests/{test_data => data}/test_schedule.py | 11 +---------- tests/{test_data => data}/test_snipe.py | 0 tests/run_tests.py | 6 ------ 8 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/test.yml rename tests/{test_data => }/__init__.py (100%) create mode 100644 tests/data/__init__.py rename tests/{test_data => data}/test_regexes.py (100%) rename tests/{test_data => data}/test_schedule.py (69%) rename tests/{test_data => data}/test_snipe.py (100%) delete mode 100644 tests/run_tests.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..147dfbc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,15 @@ +name: Deploy + +on: + push: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.9.5' + - run: pip3 install -r requirements.txt + - run: pytest tests \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 083a9f5..dc9dcba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,4 +16,5 @@ googletrans==4.0.0rc1 quart==0.15.1 Quart-CORS==0.5.0 attrs~=21.2.0 -dacite~=1.6.0 \ No newline at end of file +dacite~=1.6.0 +pytest==6.2.4 \ No newline at end of file diff --git a/tests/test_data/__init__.py b/tests/__init__.py similarity index 100% rename from tests/test_data/__init__.py rename to tests/__init__.py diff --git a/tests/data/__init__.py b/tests/data/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_data/test_regexes.py b/tests/data/test_regexes.py similarity index 100% rename from tests/test_data/test_regexes.py rename to tests/data/test_regexes.py diff --git a/tests/test_data/test_schedule.py b/tests/data/test_schedule.py similarity index 69% rename from tests/test_data/test_schedule.py rename to tests/data/test_schedule.py index 22916cc..34fbb3e 100644 --- a/tests/test_data/test_schedule.py +++ b/tests/data/test_schedule.py @@ -1,7 +1,6 @@ -import pytz - from data import schedule from datetime import datetime +import pytz import unittest @@ -17,11 +16,3 @@ class TestSchedule(unittest.TestCase): self.assertFalse(holiday.has_passed(before)) self.assertFalse(holiday.has_passed(during)) self.assertTrue(holiday.has_passed(after)) - - def test_course_str(self): - course = schedule.Course("Test") - self.assertEqual(str(course), "Test") - - def test_location_str(self): - location = schedule.Location("C", "B", "R") - self.assertEqual(str(location), "C B R") diff --git a/tests/test_data/test_snipe.py b/tests/data/test_snipe.py similarity index 100% rename from tests/test_data/test_snipe.py rename to tests/data/test_snipe.py diff --git a/tests/run_tests.py b/tests/run_tests.py deleted file mode 100644 index 4b64cea..0000000 --- a/tests/run_tests.py +++ /dev/null @@ -1,6 +0,0 @@ -import unittest - - -if __name__ == "__main__": - suite = unittest.TestLoader().discover('.', pattern="test_*.py") - unittest.TextTestRunner(verbosity=3).run(suite)