pittcsc / PittAPI

An API to easily get data from the University of Pittsburgh
https://pittapi.pittcsc.org
GNU General Public License v2.0
105 stars 30 forks source link

Update pre-commit hooks to v4.6.0 and add `trailing-whitespace` hook #163

Closed tianyizheng02 closed 1 month ago

tianyizheng02 commented 1 month ago

Updated .pre-commit-config.yaml to use the newest version of pre-commit hooks (v4.6.0). I also took the liberty of adding the trailing-whitespace hook, since I consider it pretty important to have. I then ran pre-commit run --all-files to fix the preexisting state of the repo (and apparently a lot of files needed fixing).

tianyizheng02 commented 1 month ago

The dining module is getting some kind of connection error, and multiple modules are getting infinite recursion errors:

=========================== short test summary info ============================
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations - requests.exceptions.ConnectionError: Connection refused by Responses - the call doesn't match any registered mock.

Request: 
- GET https://api.dineoncampus.com/v1/locations/status?site_id=5e6fcc641ca48e0cacd93b04&platform=

Available matches:
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=0 URL does not match
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=10 URL does not match
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=20 URL does not match
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations_by_status_closed - AttributeError: module 'pittapi.dining' has no attribute 'get_locations_by_status'
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations_by_status_open - AttributeError: module 'pittapi.dining' has no attribute 'get_locations_by_status'
FAILED tests/lab_test.py::LabTest::test_fetch_labs - RecursionError: maximum recursion depth exceeded
FAILED tests/lab_test.py::LabTest::test_get_status - RecursionError: maximum recursion depth exceeded
FAILED tests/library_test.py::LibraryTest::test_get_documents - RecursionError: maximum recursion depth exceeded
FAILED tests/people_test.py::PeopleTest::test_people_get_person - RecursionError: maximum recursion depth exceeded
FAILED tests/people_test.py::PeopleTest::test_people_get_person_none - RecursionError: maximum recursion depth exceeded
FAILED tests/people_test.py::PeopleTest::test_people_get_person_too_many - RecursionError: maximum recursion depth exceeded
=================== 9 failed, 41 passed, 2 skipped in 4.66s ====================

I don't think this is due to any of the pre-commit changes?

tianyizheng02 commented 1 month ago
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations - requests.exceptions.ConnectionError: Connection refused by Responses - the call doesn't match any registered mock.

Request: 
- GET https://api.dineoncampus.com/v1/locations/status?site_id=5e6fcc641ca48e0cacd93b04&platform=

Available matches:
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=0 URL does not match
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=10 URL does not match
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=20 URL does not match
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations_by_status_closed - AttributeError: module 'pittapi.dining' has no attribute 'get_locations_by_status'
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations_by_status_open - AttributeError: module 'pittapi.dining' has no attribute 'get_locations_by_status'

I believe these three failing dining module tests are due to the changes made in #161, since that PR drastically changed the dining module API.