Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for proxy_study_artifact #712

Merged
merged 5 commits into from
Nov 27, 2023

Conversation

eukaryo
Copy link
Contributor

@eukaryo eukaryo commented Nov 27, 2023

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

This PR adds tests for proxy_study_artifact.

What does this implement/fix? Explain your changes.

The added tests check the following:

  1. Whether the bad request (400) will be returned when an artifact_store is not given,
  2. Whether the not found (404) will be returned when an artifact_store exists but requested artifact_id is not found,
  3. Whether we can successfully obtain data when an artifact_store exists and requested artifact_id is valid.

Copy link

codecov bot commented Nov 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (bf7c930) 63.77% compared to head (ff210f5) 64.62%.
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
+ Coverage   63.77%   64.62%   +0.85%     
==========================================
  Files          35       35              
  Lines        2280     2284       +4     
==========================================
+ Hits         1454     1476      +22     
+ Misses        826      808      -18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

Thank you for your pull requests. I left some comments.

@@ -80,3 +88,49 @@ def test_list_trial_artifacts(init_storage_with_artifact_meta: MagicMock) -> Non
{"artifact_id": "id1", "filename": "bar.txt"},
{"artifact_id": "id2", "filename": "baz.txt"},
]


class TestProxyStudyArtifact(TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

Could you use pytest instead of unittest's class-based style since we now use pytest as a test runner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I have revised the code.

python_tests/artifact/test_backend.py Outdated Show resolved Hide resolved
python_tests/artifact/test_backend.py Outdated Show resolved Hide resolved
python_tests/artifact/test_backend.py Outdated Show resolved Hide resolved
@c-bata c-bata self-assigned this Nov 27, 2023
eukaryo and others added 4 commits November 27, 2023 16:29
Co-authored-by: c-bata <c-bata@users.noreply.github.com>
Co-authored-by: c-bata <c-bata@users.noreply.github.com>
Co-authored-by: c-bata <c-bata@users.noreply.github.com>
Copy link
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

Looks great to me 👍

@c-bata c-bata merged commit ed5d91b into optuna:main Nov 27, 2023
13 checks passed
@not522 not522 mentioned this pull request Nov 28, 2023
1 task
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.

2 participants