[MNT] Replace live server calls with mocks in test_list_flows (test_flows/test_flow_functions.py)#1670
Open
anuj452005 wants to merge 1 commit intoopenml:mainfrom
Open
[MNT] Replace live server calls with mocks in test_list_flows (test_flows/test_flow_functions.py)#1670anuj452005 wants to merge 1 commit intoopenml:mainfrom
anuj452005 wants to merge 1 commit intoopenml:mainfrom
Conversation
Author
|
@geetu040 review please . |
20 tasks
geetu040
suggested changes
Feb 20, 2026
| assert ext_version_str_or_none | ||
|
|
||
| @pytest.mark.production_server() | ||
| def test_list_flows(self): |
Collaborator
There was a problem hiding this comment.
why did you have to remove test_list_flows from being a class method?
| assert isinstance(flow["full_name"], str) | ||
| assert isinstance(flow["version"], str) | ||
| ext_v = flow["external_version"] | ||
| assert isinstance(ext_v, str) or ext_v is None or pd.isna(ext_v) |
Collaborator
There was a problem hiding this comment.
this is not need, since we are using hard-coded flows, these checks should always pass
Comment on lines
+559
to
+562
| # Verify the mock was called and URL contains the list endpoint | ||
| assert mock_get.called | ||
| call_url = mock_get.call_args.args[0] | ||
| assert "flow/list" in call_url |
Collaborator
There was a problem hiding this comment.
are you checking all the parameters? make sure you verify each argument that was given to Session.get
Author
There was a problem hiding this comment.
okk , I will update it to check the exact full URL and verify all the kwargs (like api_key).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Metadata
Details
This PR converts test_list_flows in tests/test_flows/test_flow_functions.py from a
@pytest.mark.production_servertest (requiring a live connection to openml.org) into anoffline unit test using
unittest.mock.Changes
TestFlowFunctions.test_list_flows(class method marked@pytest.mark.production_server)@mock.patch.object(requests.Session, "get"),consistent with the existing
test_delete_flow_*pattern in the same filecontaining all 6 fields read by __list_flows (id,
full_name,name, version,external_version,uploader)Testing
# Passes offline, no network required pytest tests/test_flows/test_flow_functions.py::test_list_flows -v