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

improve pytest download tooling #421

Merged
merged 2 commits into from
Oct 14, 2024
Merged

improve pytest download tooling #421

merged 2 commits into from
Oct 14, 2024

Conversation

michaelfeil
Copy link
Owner

This pull request introduces several changes to the test suite to improve the handling of sample data and refactor the code for consistency. The key changes include adding fixtures for downloading sample files, updating test cases to use these fixtures, and modifying assertions for numerical comparisons.

Improvements to sample data handling:

Test case updates:

Code cleanup:

  • Removed redundant requests imports from several test files (libs/infinity_emb/tests/end_to_end/test_torch_audio.py, libs/infinity_emb/tests/end_to_end/test_torch_vision.py, libs/infinity_emb/tests/unit_test/test_engine.py, libs/infinity_emb/tests/unit_test/transformer/audio/test_audio.py, libs/infinity_emb/tests/unit_test/transformer/vision/test_torch_vision.py). [1] [2] [3] [4] [5]

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This pull request improves the test suite for the infinity_emb library, focusing on consistency, reliability, and code organization.

  • Added _download function and sample fixtures in libs/infinity_emb/tests/conftest.py for better sample data handling
  • Updated test_audio_base64 and test_vision_base64 to use new fixtures and improve numerical comparisons
  • Refactored test cases in test_engine.py, test_audio.py, and test_torch_vision.py to use default model names and new fixtures
  • Improved error handling in url_to_base64 function in test_openapi_client_compat.py
  • Removed redundant requests imports across multiple test files for cleaner code

7 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

libs/infinity_emb/tests/conftest.py Show resolved Hide resolved

@pytest.fixture(scope="function")
def image_sample() -> tuple[requests.Response, str]:
return (_download(pytest.IMAGE_SAMPLE_URL, stream=True)), pytest.IMAGE_SAMPLE_URL # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Remove unnecessary parentheses around _download(pytest.IMAGE_SAMPLE_URL, stream=True)

@michaelfeil michaelfeil changed the title improve pytest improve pytest download tooling Oct 12, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.13%. Comparing base (08e4cc1) to head (516ecb1).
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #421   +/-   ##
=======================================
  Coverage   79.13%   79.13%           
=======================================
  Files          40       40           
  Lines        3173     3173           
=======================================
  Hits         2511     2511           
  Misses        662      662           

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

Copy link
Owner Author

@michaelfeil michaelfeil left a comment

Choose a reason for hiding this comment

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

good to merge

@michaelfeil michaelfeil merged commit 0f1b786 into main Oct 14, 2024
36 checks passed
@michaelfeil michaelfeil deleted the improve-pytest branch October 14, 2024 01:43
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