local_pathfinding/test/test_global_path.py has a unit test for get_pos() which depends on the availability of a separate HTTP server to handle a GET request. It would be better to make all unit tests fully encapsulated and just mock http endpoints.
Testing the functionality of the actual http endpoints should be out of the scope of unit tests for individual files.
Expected Behavior
Unit tests pass without dependency on any other sailbot_workspace packages
Actual Behavior
~Unit tests fail when the expected response is not received from the endpoint.~
~Running the test task on the main branch of sailbot_workspace should always pass.~
The test task actually works now for the get_pos() function. I still want to modify the test to use a mocked http server rather than depending on the endpoint used by get_pos()
Description
local_pathfinding/test/test_global_path.py has a unit test for
get_pos()
which depends on the availability of a separate HTTP server to handle a GET request. It would be better to make all unit tests fully encapsulated and just mock http endpoints.Testing the functionality of the actual http endpoints should be out of the scope of unit tests for individual files.
Expected Behavior
Unit tests pass without dependency on any other sailbot_workspace packages
Actual Behavior
~Unit tests fail when the expected response is not received from the endpoint.~ ~Running the test task on the main branch of sailbot_workspace should always pass.~
The test task actually works now for the
get_pos()
function. I still want to modify the test to use a mocked http server rather than depending on the endpoint used byget_pos()
Relevant Code
test_global_path.py
Potential Solutions
Mock the http endpoint behavior.
Resources