Skip to content

Add test_roi_thumbnails()#6235

Merged
joshmoore merged 9 commits intoome:developfrom
will-moore:render_roi_thumbnail_tests
Jun 16, 2020
Merged

Add test_roi_thumbnails()#6235
joshmoore merged 9 commits intoome:developfrom
will-moore:render_roi_thumbnail_tests

Conversation

@will-moore
Copy link
Copy Markdown
Member

Adds tests for ome/omero-web#157
Tests fail without that PR

@will-moore
Copy link
Copy Markdown
Member Author

Removed last commit (flake8 fix) since it's been ported to a separate PR #6236

@joshmoore
Copy link
Copy Markdown
Member

Re-opening with #6236 merged.

@joshmoore joshmoore closed this Jun 3, 2020
@joshmoore joshmoore reopened this Jun 3, 2020
Comment thread components/tools/OmeroWeb/test/integration/test_thumbnails.py
Comment thread components/tools/OmeroWeb/test/integration/test_thumbnails.py Outdated
Comment thread components/tools/OmeroWeb/test/integration/test_thumbnails.py Outdated
@will-moore
Copy link
Copy Markdown
Member Author

will-moore commented Jun 4, 2020

Yes, I tried import rgba_to_int from test_api_rois before (see 46c37f8) but for some reason this import fails:

$ pytest test/integration/test_thumbnails.py 
======================================================================= test session starts =======================================================================
platform darwin -- Python 3.6.10, pytest-5.3.4, py-1.8.1, pluggy-0.13.1
django: settings: omeroweb.settings (from ini)
rootdir: /Users/wmoore/Desktop/OMERO/openmicroscopy/components/tools, inifile: pytest.ini
plugins: forked-1.1.3, django-3.8.0
collected 0 items / 1 error                                                                                                                                       

============================================================================= ERRORS ==============================================================================
__________________________________________________ ERROR collecting OmeroWeb/test/integration/test_thumbnails.py __________________________________________________
ImportError while importing test module '/Users/wmoore/Desktop/OMERO/openmicroscopy/components/tools/OmeroWeb/test/integration/test_thumbnails.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/integration/test_thumbnails.py:32: in <module>
    from test_api_rois import rgba_to_int
E   ModuleNotFoundError: No module named 'test_api_rois'

although I'm also getting similar import errors on other tests, so I've got something wrong locally.

@will-moore will-moore force-pushed the render_roi_thumbnail_tests branch from 9768603 to a7f4d21 Compare June 4, 2020 21:39
@jburel
Copy link
Copy Markdown
Member

jburel commented Jun 5, 2020

rgba_to_int the method could go in a test lib package since it used by the tests

@jburel
Copy link
Copy Markdown
Member

jburel commented Jun 5, 2020

Thanks for the first round of changes. As mentioned above the method needs to be moved to a common file

Comment thread components/tools/OmeroWeb/test/integration/utils.py Outdated
Comment thread components/tools/OmeroWeb/test/integration/test_thumbnails.py Outdated
thumb = Image.open(thumb_bytes)
finally:
thumb_bytes.close()
assert thumb.size == (250, 166)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

where is that size defined?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might be worth extracting such magic numbers out to a constant somewhere (at some point in the future)

@jburel
Copy link
Copy Markdown
Member

jburel commented Jun 9, 2020

Looking at the various methods to generate thumbnails.
I noticed that the IO resources are not closed in the method implementation.
So this is a good time to tackle that problem and see if the tests remain green

@will-moore
Copy link
Copy Markdown
Member Author

Closed BytesIO in webgateway get_shape_thumbnail() in ome/omero-web@e2fc30c

@will-moore will-moore closed this Jun 15, 2020
@will-moore will-moore reopened this Jun 15, 2020
@will-moore will-moore force-pushed the render_roi_thumbnail_tests branch from db68982 to b4ee04a Compare June 15, 2020 21:30
@joshmoore
Copy link
Copy Markdown
Member

@joshmoore joshmoore merged commit fd7a1f1 into ome:develop Jun 16, 2020
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.

4 participants