Skip to content

Conversation

@will-moore
Copy link
Member

@will-moore will-moore commented Apr 1, 2025

WIP - adding more tests...

@will-moore
Copy link
Member Author

@jburel @joshmoore Any ideas how I install omero-rois that is needed for running tests. I've tried installing it in .omeroci/app-deps and in .omeroci/app-build but they don't seem to have any effect?

@joshmoore
Copy link
Member

Since you're running STAGE: cli you need to update scripts starting with cli-*

@will-moore
Copy link
Member Author

I'm looking at https://github.com/ome/omero-test-infra?tab=readme-ov-file#hooks and the scripts I see there don't include any that start with cli-.
Maybe that's not a complete list and cli-deps will work? I can try....

@will-moore
Copy link
Member Author

Nope, it didn't work. The file was copied over:

copying .omeroci/cli-deps -> omero_cli_zarr-0.1.dev1+g3e6e587/.omeroci

but the test still failed as before:

>       from omero_rois.library import mask_from_binary_image
E       ModuleNotFoundError: No module named 'omero_rois'

At this point it's probably easier for me to copy over the mask_from_binary_image() function that I need and move on!

@will-moore will-moore marked this pull request as ready for review April 3, 2025 09:47
@will-moore will-moore mentioned this pull request Apr 3, 2025
@will-moore
Copy link
Member Author

Green now!
My motivation for this PR was because I realise that #169 and #170 had breaking changes but were still "green" because of the lack of tests.
So it would be good to get this one in ahead of those.

@will-moore will-moore requested a review from joshmoore April 3, 2025 09:52
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# Code copied from omero-rois as I could not find a way to install it
Copy link
Member

Choose a reason for hiding this comment

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

This is still the case, despite cli-deps? Should I give it a try?

Copy link
Member Author

Choose a reason for hiding this comment

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

@joshmoore Yes, please try it. Or just check I've got it right at 55e5624 above (and see the corresponding test failure)

Copy link
Member

Choose a reason for hiding this comment

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

Ok. So I can get to:

test/integration/clitest/test_export.py::TestRender::test_export_zarr PASSED [ 33%]
test/integration/clitest/test_export.py::TestRender::test_export_plate PASSED [ 66%]
test/integration/clitest/test_export.py::TestRender::test_export_masks PASSED [100%]

with the following:

  • remove the omero_rois file
  • add omero_rois in setup.py as a main dependency

The reason that cli-deps didn't help is that https://github.com/ome/omero-test-infra/blob/master/docker#L213-L224 doesn't run "cli deps".

Either in cli-build or py-setup we need a command that installs the test dependencies. (Or we update the cli target to run cli-deps or similar)

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, thanks for testing.
I was reluctant to add omero_rois as a main dependency when it's only used for setting up tests.
But can do if that's preferable to the copying over the code I needed?

I opened a PR at ome/omero-test-infra#76 to add run cli deps but don't know if that helps immediately?

Copy link
Member

Choose a reason for hiding this comment

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

Probably easiest is to just override one of the py-* commands with whatever would install the additional test requirement.

@snoopycrimecop
Copy link
Member

snoopycrimecop commented Apr 4, 2025

Conflicting PR. Removed from build OMERO-plugins-push#377. See the console output for more details.
Possible conflicts:

--conflicts Conflict resolved in build OMERO-plugins-push#378. See the console output for more details.

@will-moore
Copy link
Member Author

Great, gha has stopped caching yesterday! https://gh.io/gha-cache-sunset
Don't really know how to fix that.

@joshmoore
Copy link
Member

E ModuleNotFoundError: No module named 'omero_rois'

Did you possible not add the py-setup file to your commit?

@will-moore
Copy link
Member Author

@joshmoore - oops! Yes, thanks I missed that.
Since the job is failing here for other reasons, I tried running locally...

Checked-out omero-test-infra into .omeroci/.omero then

$ .omero/docker cli
...

waiting on port: #28
waiting on port: #29
waiting on port: #30
Sleeping for 30
Login attempt 1 failed. Trying again in 2 seconds
Login attempt 2 failed. Trying again in 3 seconds
Login attempt 3 failed. Trying again in 4 seconds
Login attempt 4 failed. Trying again in 5 seconds
Login attempt 5 failed. Trying again in 6 seconds
travis_fold:end:wait-on-login
+ TARGET=/.omeroci
+++ dirname -- /infra/py-common
++ cd -P -- /infra
++ pwd -P
+ dir=/infra
+ cd /.omeroci
+ pip install --upgrade build
Collecting build
  Downloading build-1.2.2.post1-py3-none-any.whl (22 kB)
Requirement already satisfied: importlib-metadata>=4.6 in /opt/omero/server/venv3/lib/python3.9/site-packages (from build) (8.6.1)
Collecting tomli>=1.1.0
  Downloading tomli-2.2.1-py3-none-any.whl (14 kB)
Collecting pyproject_hooks
  Downloading pyproject_hooks-1.2.0-py3-none-any.whl (10 kB)
Requirement already satisfied: packaging>=19.1 in /opt/omero/server/venv3/lib/python3.9/site-packages (from build) (24.2)
Requirement already satisfied: zipp>=3.20 in /opt/omero/server/venv3/lib/python3.9/site-packages (from importlib-metadata>=4.6->build) (3.21.0)
Installing collected packages: tomli, pyproject-hooks, build
Successfully installed build-1.2.2.post1 pyproject-hooks-1.2.0 tomli-2.2.1
WARNING: You are using pip version 21.3.1; however, version 25.0.1 is available.
You should consider upgrading via the '/opt/omero/server/venv3/bin/python3 -m pip install --upgrade pip' command.
+ pip install --upgrade -r /infra/requirements.txt
Collecting flake8
  Downloading flake8-7.2.0-py2.py3-none-any.whl (57 kB)
...
...
Collecting distlib<1,>=0.3.7
  Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
Collecting webencodings
  Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Using legacy 'setup.py install' for restructuredtext-lint, since package 'wheel' is not installed.
Installing collected packages: webencodings, pygments, pyflakes, pycodestyle, pluggy, platformdirs, mccabe, iniconfig, filelock, exceptiongroup, docutils, distlib, bleach, virtualenv, readme-renderer, pytest, nodeenv, identify, flake8, cfgv, restview, restructuredtext-lint, pytest-mock, pytest-django, pre-commit, pep8-naming, attrs
    Running setup.py install for restructuredtext-lint: started
    Running setup.py install for restructuredtext-lint: finished with status 'done'
Successfully installed attrs-25.3.0 bleach-6.2.0 cfgv-3.4.0 distlib-0.3.9 docutils-0.21.2 exceptiongroup-1.2.2 filelock-3.18.0 flake8-7.2.0 identify-2.6.10 iniconfig-2.1.0 mccabe-0.7.0 nodeenv-1.9.1 pep8-naming-0.14.1 platformdirs-4.3.7 pluggy-1.5.0 pre-commit-4.2.0 pycodestyle-2.13.0 pyflakes-3.3.2 pygments-2.19.1 pytest-8.3.5 pytest-django-4.11.1 pytest-mock-3.14.0 readme-renderer-36.0 restructuredtext-lint-1.4.0 restview-3.0.2 virtualenv-20.30.0 webencodings-0.5.1
WARNING: You are using pip version 21.3.1; however, version 25.0.1 is available.
You should consider upgrading via the '/opt/omero/server/venv3/bin/python3 -m pip install --upgrade pip' command.
+ TARGET=/.omeroci
+ git config --global --add safe.directory /.omeroci
+ cd /.omeroci
+ '[' -f .pre-commit-config.yaml ']'
+ flake8 -v .
flake8.checker            MainProcess    679 INFO     Making checkers
flake8.main.application   MainProcess    698 INFO     Finished running
flake8.main.application   MainProcess    698 INFO     Reporting errors
flake8.main.application   MainProcess    699 INFO     Found a total of 0 violations and reported 0
+ '[' -f README.rst ']'
+ rst-lint README.md
Path "README.md" not found as a file nor directory
[+] Running 4/3
 ⠿ Container omeroci-db-1     Removed                                                                                                                0.8s
 ⠿ Container omeroci-web-1    Removed                                                                                                                0.7s
 ⠿ Container omeroci-omero-1  Removed                                                                                                                0.8s
 ⠿ Network omeroci_default    Removed 

Not sure that the tests actually ran, or if they did, what the results were?

@joshmoore
Copy link
Member

Pushed a fix of py-setup; tests are passing locally.

@joshmoore
Copy link
Member

Green!

@will-moore
Copy link
Member Author

Wow, thanks @joshmoore!

Any feedback on the tests themselves, or can we just get them in and go from there?

There's one fix in the code was for exporting masks -> labels when theC is set on a mask - now theC is ignored (instead of exporting labels that have a sizeC > 1.

Also this PR fixes handling of output path with $ omero zarr masks Image:1 --output path as used in the test (previously --output was being ignored here)

Copy link
Member

@joshmoore joshmoore left a comment

Choose a reason for hiding this comment

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

Barring the one minor catch, I'd say let's get these in. Then we can build on top of them, e.g., as we move towards OME-Zarr 0.5 😄

url="https://github.com/ome/omero-cli-zarr/",
setup_requires=["setuptools_scm==7.1.0"],
use_scm_version={"write_to": "src/omero_zarr/_version.py"},
tests_require=["omero-py>=5.18.0", "pytest", "omero-rois"],
Copy link
Member

Choose a reason for hiding this comment

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

Oops. I think we wanted to omit this omero-rois, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm happy to remove it. Could remove the whole line as it's not being used? Unless it's useful to someone running the tests locally to know that omero-rois is required?

Copy link
Member

Choose a reason for hiding this comment

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

Good point. Let's leave it for local development. We can always review later. 👍

@will-moore will-moore merged commit 5b2ca82 into ome:master Apr 24, 2025
2 checks passed
@will-moore will-moore deleted the integration_tests branch April 24, 2025 12:49
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.

3 participants