diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 9034ac2..18a252d 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -24,6 +24,7 @@ name: tests env: APP_NAME: uw_r25 + COVERAGE_PYTHON_VERSION: '3.10' on: push: @@ -37,22 +38,29 @@ on: jobs: test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 + + strategy: + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v2 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - python-version: 3.6 + python-version: ${{ matrix.python-version }} - name: Install Dependencies run: | python -m pip install --upgrade pip pip install -e . - pip install commonconf nose2 coverage coveralls==2.2.0 + pip install commonconf nose2 coverage coveralls==3.3.1 - name: Run Python Linters uses: uw-it-aca/actions/python-linters@main @@ -62,9 +70,10 @@ jobs: - name: Run Tests run: | python -m compileall ${APP_NAME}/ - coverage run ${APP_NAME}/test.py -v + python -Wd -m coverage run ${APP_NAME}/test.py -v - name: Report Test Coverage + if: matrix.python-version == env.COVERAGE_PYTHON_VERSION env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash @@ -75,16 +84,16 @@ jobs: needs: test - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: '3.10' - name: Publish to PyPi uses: uw-it-aca/actions/publish-pypi@main diff --git a/README.md b/README.md index d284227..a1c2ba5 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ [![Build Status](https://github.com/uw-it-aca/uw-restclients-r25/workflows/tests/badge.svg?branch=main)](https://github.com/uw-it-aca/uw-restclients-r25/actions) [![Coverage Status](https://coveralls.io/repos/uw-it-aca/uw-restclients-r25/badge.svg?branch=main)](https://coveralls.io/r/uw-it-aca/uw-restclients-r25?branch=main) [![PyPi Version](https://img.shields.io/pypi/v/uw-restclients-r25.svg)](https://pypi.python.org/pypi/uw-restclients-r25) -![Python versions](https://img.shields.io/pypi/pyversions/uw-restclients-r25.svg) - +![Python versions](https://img.shields.io/badge/python-3.10-blue.svg) Installation: diff --git a/setup.py b/setup.py index c7695e1..3e5084f 100644 --- a/setup.py +++ b/setup.py @@ -17,12 +17,12 @@ name='UW-RestClients-R25', version=VERSION, packages=['uw_r25'], - author="UW-IT AXDD", + author="UW-IT T&LS", author_email="aca-it@uw.edu", include_package_data=True, install_requires=[ 'UW-RestClients-Core', - 'lxml', + 'lxml<5', ], license='Apache License, Version 2.0', description=('A library for connecting to the UW R25 API'), @@ -33,6 +33,5 @@ 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', ], ) diff --git a/uw_r25/__init__.py b/uw_r25/__init__.py index 7130fff..b6acc32 100644 --- a/uw_r25/__init__.py +++ b/uw_r25/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from uw_r25.dao import R25_DAO diff --git a/uw_r25/dao.py b/uw_r25/dao.py index 4b9afa3..18578f4 100644 --- a/uw_r25/dao.py +++ b/uw_r25/dao.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 import logging diff --git a/uw_r25/events.py b/uw_r25/events.py index 4f4b284..ef9db17 100644 --- a/uw_r25/events.py +++ b/uw_r25/events.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from uw_r25.models import Event, BindingReservation diff --git a/uw_r25/models.py b/uw_r25/models.py index 4e51c7f..691a443 100644 --- a/uw_r25/models.py +++ b/uw_r25/models.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from restclients_core import models diff --git a/uw_r25/reservations.py b/uw_r25/reservations.py index b2f8fda..80bc26a 100644 --- a/uw_r25/reservations.py +++ b/uw_r25/reservations.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from uw_r25.models import Reservation diff --git a/uw_r25/spaces.py b/uw_r25/spaces.py index 1b9d9c4..691f374 100644 --- a/uw_r25/spaces.py +++ b/uw_r25/spaces.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from uw_r25.models import Space diff --git a/uw_r25/test.py b/uw_r25/test.py index f1bc1dc..f259cc7 100644 --- a/uw_r25/test.py +++ b/uw_r25/test.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 # This is just a test runner for coverage diff --git a/uw_r25/tests/test_dao.py b/uw_r25/tests/test_dao.py index 25b7af4..e948515 100644 --- a/uw_r25/tests/test_dao.py +++ b/uw_r25/tests/test_dao.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from unittest import TestCase @@ -11,7 +11,7 @@ class R25TestDao(TestCase): def test_custom_headers(self): self.assertFalse(R25_DAO()._custom_headers('GET', '/', {}, None)) with override_settings(RESTCLIENTS_R25_BASIC_AUTH='b64here'): - self.assertEquals( + self.assertEqual( R25_DAO()._custom_headers('GET', '/', {}, None), {'Authorization': 'Basic b64here'} ) diff --git a/uw_r25/tests/test_events.py b/uw_r25/tests/test_events.py index e652c9c..f727ef4 100644 --- a/uw_r25/tests/test_events.py +++ b/uw_r25/tests/test_events.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from unittest import TestCase, skipIf @@ -13,49 +13,49 @@ class R25TestEvents(TestCase): def test_event_by_id(self): event = get_event_by_id("100000") - self.assertEquals(event.event_id, "100000", "event_id") - self.assertEquals(event.name, "BOTHELL WINTER 2013 CABINET", "name") - self.assertEquals(event.title, "BOTHELL WINTER 2013 CABINET", "title") - self.assertEquals(event.alien_uid, None, "alien_uid") - self.assertEquals(event.start_date, "2013-01-01", "start_date") - self.assertEquals(event.end_date, "2013-03-28", "end_date") - self.assertEquals(event.state, "1", "state") - self.assertEquals(event.parent_id, None, "parent_id") - self.assertEquals(event.cabinet_id, event.event_id, "cabinet_id") - self.assertEquals(event.cabinet_name, event.name, "cabinet_name") - self.assertEquals(event.state_name(), "Tentative", "state_name") - self.assertEquals(len(event.reservations), 1, "reservations") - self.assertEquals( + self.assertEqual(event.event_id, "100000", "event_id") + self.assertEqual(event.name, "BOTHELL WINTER 2013 CABINET", "name") + self.assertEqual(event.title, "BOTHELL WINTER 2013 CABINET", "title") + self.assertEqual(event.alien_uid, None, "alien_uid") + self.assertEqual(event.start_date, "2013-01-01", "start_date") + self.assertEqual(event.end_date, "2013-03-28", "end_date") + self.assertEqual(event.state, "1", "state") + self.assertEqual(event.parent_id, None, "parent_id") + self.assertEqual(event.cabinet_id, event.event_id, "cabinet_id") + self.assertEqual(event.cabinet_name, event.name, "cabinet_name") + self.assertEqual(event.state_name(), "Tentative", "state_name") + self.assertEqual(len(event.reservations), 1, "reservations") + self.assertEqual( len(event.binding_reservations), 1, "binding_reservations") def test_parent_event(self): event = get_event_by_id("100002") parent = event.parent() - self.assertEquals(parent.event_id, event.parent_id, "parent_id") + self.assertEqual(parent.event_id, event.parent_id, "parent_id") # No parent event parent2 = parent.parent() - self.assertEquals(parent2, None, "parent_id") + self.assertEqual(parent2, None, "parent_id") def test_child_events(self): event = get_event_by_id("100000") children = event.children() - self.assertEquals(len(children), 1, "child event count") + self.assertEqual(len(children), 1, "child event count") # No child events child = children[0] children = child.children() - self.assertEquals(len(children), 0, "child event count") + self.assertEqual(len(children), 0, "child event count") def test_cabinet_event(self): event = get_event_by_id("100002") cabinet = event.cabinet() - self.assertEquals(cabinet.event_id, event.cabinet_id, "cabinet_id") + self.assertEqual(cabinet.event_id, event.cabinet_id, "cabinet_id") # cabinet is self cabinet2 = cabinet.cabinet() - self.assertEquals(cabinet2.event_id, cabinet.event_id, "cabinet_id") + self.assertEqual(cabinet2.event_id, cabinet.event_id, "cabinet_id") def test_all_events(self): events = get_events() - self.assertEquals(len(events), 3, "event count") + self.assertEqual(len(events), 3, "event count") diff --git a/uw_r25/tests/test_reservations.py b/uw_r25/tests/test_reservations.py index 5eecb38..cc928ec 100644 --- a/uw_r25/tests/test_reservations.py +++ b/uw_r25/tests/test_reservations.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from unittest import TestCase diff --git a/uw_r25/tests/test_spaces.py b/uw_r25/tests/test_spaces.py index a467c37..46a137e 100644 --- a/uw_r25/tests/test_spaces.py +++ b/uw_r25/tests/test_spaces.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from unittest import TestCase @@ -13,10 +13,10 @@ class R25TestSpaces(TestCase): def test_space_by_id(self): space = get_space_by_id("1000") - self.assertEquals(space.space_id, "1000", "space_id") - self.assertEquals(space.name, "ACC 120", "name") - self.assertEquals(space.formal_name, "Smith Hall", "formal_name") + self.assertEqual(space.space_id, "1000", "space_id") + self.assertEqual(space.name, "ACC 120", "name") + self.assertEqual(space.formal_name, "Smith Hall", "formal_name") def test_all_spaces(self): spaces = get_spaces() - self.assertEquals(len(spaces), 3, "space count") + self.assertEqual(len(spaces), 3, "space count") diff --git a/uw_r25/util/__init__.py b/uw_r25/util/__init__.py index e0a4d9f..a1777cb 100644 --- a/uw_r25/util/__init__.py +++ b/uw_r25/util/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2021 UW-IT, University of Washington +# Copyright 2024 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from restclients_core.util.decorators import use_mock