Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@akrishan11
Copy link
Collaborator

@akrishan11 akrishan11 commented May 20, 2024

Fixes #164

Updated tests for functions in new Dining module

Added mocks for dining locations, dining menu, and dining schedule

@akrishan11 akrishan11 changed the title updated dining tests Updated dining tests May 20, 2024
@tianyizheng02
Copy link
Contributor

Edited the PR description to automatically link the PR to the correct issue

Copy link
Contributor

@tianyizheng02 tianyizheng02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests look good, I think. Where do the contents of the new JSON files come from, BTW?

@tianyizheng02
Copy link
Contributor

=========================== short test summary info ============================
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
=================== 6 failed, 44 passed, 2 skipped in 4.28s ====================

The tests that are failing don't have anything to do with the dining module, gonna try to take a look at the code to see if there are any patterns.

akrishan11 and others added 2 commits May 20, 2024 22:59
Co-authored-by: Tianyi Zheng <[email protected]>
Co-authored-by: Tianyi Zheng <[email protected]>
@akrishan11
Copy link
Collaborator Author

Tests look good, I think. Where do the contents of the new JSON files come from, BTW?

I just copied the exact data that would be returned from the Dine on Campus at the specific endpoints called by the sample function calls. I don't have much experience writing tests so I'm not sure if there was anything wrong with my approach.

@tianyizheng02
Copy link
Contributor

The tests that are failing don't have anything to do with the dining module, gonna try to take a look at the code to see if there are any patterns.

OK, I'm pretty sure the failing tests are failing because their inputs aren't mocked. The failing tests in lab_test.py, library_test.py, and people_test.py all run the module functions directly (i.e. make HTTP requests) as opposed to calling the function with mocked inputs. All function tests for other modules (that aren't skipped) do mock their inputs, and those are clearly passing. My guess is that real HTTP requests get messed up when the enclosing functions are run from a test environment, probably something to do with shared resources in the test environment.

TL;DR the tests in lab_test.py, library_test.py, and people_test.py all should be rewritten to use mocked inputs instead of making real HTTP requests.

@nij-patel nij-patel merged commit d7cdd34 into pittcsc:dev May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken/outdated tests for dining module

3 participants