Conversation
for more information, see https://pre-commit.ci
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1616 +/- ##
==========================================
- Coverage 52.04% 47.50% -4.54%
==========================================
Files 36 64 +28
Lines 4333 5115 +782
==========================================
+ Hits 2255 2430 +175
- Misses 2078 2685 +607 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
…-11/openml-python into runs-migration-stacked
This reverts commit fd43c48.
…into runs-migration-stacked
- removing this since it was not part of the sdk previously - some tests fail because of the timeout in stacked PRs - this option can easily be added if needed in future
…into runs-migration-stacked
tests/test_api/test_run.py
Outdated
| if "description" not in file_elements: | ||
| file_elements["description"] = run._to_xml() | ||
|
|
||
| run_id = self.resource.publish(path="run", files=file_elements) |
There was a problem hiding this comment.
this should be delete afterward, use TestBase._mark_entity_for_removal
apply at other places as well
tests/test_api/test_run.py
Outdated
| assert isinstance(run_id, int) | ||
| assert run_id > 0 | ||
|
|
||
| @pytest.mark.uses_test_server() |
There was a problem hiding this comment.
marker can be moved at class level if all tests require this
tests/test_api/test_run.py
Outdated
| self.v2_http_client = self._get_http_client( | ||
| server="http://127.0.0.1:8001/", | ||
| base_url="", | ||
| api_key=self.api_key, | ||
| timeout=self.timeout, | ||
| retries=self.retries, | ||
| retry_policy=self.retry_policy, | ||
| cache=self.cache, | ||
| ) |
There was a problem hiding this comment.
this can be self.http_clients[APIVersion.V2]
| @@ -1658,13 +1666,60 @@ def test_run_on_dataset_with_missing_labels_array(self): | |||
|
|
|||
| @pytest.mark.uses_test_server() | |||
| def test_get_cached_run(self): | |||
There was a problem hiding this comment.
you can remove this function entirely, we test cache at client level
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
@mock.patch.object(requests.Session, "delete")
def test_delete_run_not_owned(mock_delete, test_files_directory, test_api_key):
openml.config.start_using_configuration_for_example()
content_file = test_files_directory / "mock_responses" / "runs" / "run_delete_not_owned.xml"
mock_delete.return_value = create_request_response(
status_code=412,
content_filepath=content_file,
)
with pytest.raises(
OpenMLNotAuthorizedError,
match="The run can not be deleted because it was not uploaded by you.",
):
openml.runs.delete_run(40_000)
run_url = "https://test.openml.org/api/v1/xml/run/40000"
assert run_url == mock_delete.call_args.args[0]
assert test_api_key == mock_delete.call_args.kwargs.get("params", {}).get("api_key")
@mock.patch.object(requests.Session, "delete")
def test_delete_run_success(mock_delete, test_files_directory, test_api_key):
openml.config.start_using_configuration_for_example()
content_file = test_files_directory / "mock_responses" / "runs" / "run_delete_successful.xml"
mock_delete.return_value = create_request_response(
status_code=200,
content_filepath=content_file,
)
success = openml.runs.delete_run(10591880)
assert success
run_url = "https://test.openml.org/api/v1/xml/run/10591880"
assert run_url == mock_delete.call_args.args[0]
assert test_api_key == mock_delete.call_args.kwargs.get("params", {}).get("api_key")
@mock.patch.object(requests.Session, "delete")
def test_delete_unknown_run(mock_delete, test_files_directory, test_api_key):
openml.config.start_using_configuration_for_example()
content_file = test_files_directory / "mock_responses" / "runs" / "run_delete_not_exist.xml"
mock_delete.return_value = create_request_response(
status_code=412,
content_filepath=content_file,
)
with pytest.raises(
OpenMLServerException,
match="Run does not exist",
):
openml.runs.delete_run(9_999_999)
run_url = "https://test.openml.org/api/v1/xml/run/9999999"
assert run_url == mock_delete.call_args.args[0]
assert test_api_key == mock_delete.call_args.kwargs.get("params", {}).get("api_key")
@geetu040 same issue as Flow PR . Should I remove these issues or modify delete ? |
Thanks for pointing this out, please modify these, here's how you can do this: #1575 (comment) |
identified while debugging openml#1616 (comment)
Metadata
Details
fixes #1624