Skip to content

End to end local Integration test for parseImage function: See issue #1 #15

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gabrielbugarija
Copy link

NOTE: The Test is local, and without an AWS key and endpoint, spinup and spindown could not be implemented.

…penAdaptAI#1

NOTE: The Test is local, and without an AWS key and endpoint, spinup and spindown could not be implemented.
@gabrielbugarija
Copy link
Author

Overview
This PR adds an integration test suite for the parse_image(...) function. The tests are designed to run entirely on a local machine and simulate end-to-end image parsing behavior using either a real API or a mocked one.

Test Capabilities

  • Uses local test images stored in the project directory
  • Encodes images in base64 and sends simulated API POST requests
  • Validates the structure and content of responses (e.g., checks for "segments")
  • Supports mocked API behavior using unittest.mock
  • Includes visual comparison of UI states using before/after screenshots
  • These tests are self-contained and can run without any cloud or AWS dependency.

Requirements

  • Make sure the following Python libraries are installed:
  • pytest – for running tests
  • Pillow (PIL) – for image handling
  • requests – for HTTP requests
  • unittest.mock – for mocking API responses
  • Test image files placed in the same directory as the script

Updates are welcome :)

@abrichr
Copy link
Member

abrichr commented Apr 3, 2025

Thanks for the contribution, @gabrielbugarija ! Good initiative getting an end-to-end test running locally.

This isn't ready to merge for a few reasons:

  • The test mocks out the actual parse_image logic, so it's not really exercising the integration path.
  • The file should be placed under tests/, following the existing structure.
  • The image diff logic using ImageChops is fragile and wouldn't hold up in more complex scenarios.
  • The naming convention for the file (test_parseImage_local.py) doesn't follow standard Python or project conventions. Stick to lowercase with underscores, e.g. test_parse_image_integration.py.
  • Hardcoding image paths and relying on manually-placed files isn't scalable. Use fixtures or temp files where possible.

Feel free to revise this PR or propose a different issue to tackle after exams. I appreciate the effort and am happy to review future contributions.

@abrichr abrichr closed this Apr 3, 2025
@abrichr abrichr reopened this Apr 3, 2025
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