Skip to content

Fix omerotools - #157

Merged
ehrenfeu merged 23 commits into
imcf:develfrom
loicsauteur:fix-omerotools
Nov 11, 2026
Merged

ehrenfeu merged 23 commits into
imcf:develfrom
loicsauteur:fix-omerotools

Conversation

@loicsauteur

Copy link
Copy Markdown

PR for issue #154

  • Removes unnecessary code in parse_url
  • Updates description of parse_url
  • Fixes some typos
  • Raises FileNotFoundError for upload_image_to_omero

All changes done with no testing. I was unable to create an env from poetry (sorry).

@ehrenfeu

ehrenfeu commented Oct 9, 2026

Copy link
Copy Markdown
Member

Thanks @loicsauteur! ❤️

🧾 An issue like this definitely reveals the need for being able to to run tests on the code.

Since we can't properly emulate the fr.igred.omero.Client behavior without a lot of potentially error-prone 🤯 mocking, I'd prefer to rewrite the entire function such that it first does all the string parsing and list assembling (in a separate function*) and only at the very end does the required client.getDataset() / client.getImage() calls.

(*that separate function should be string-based only, making it approachable for pytest 🧪)

Would you like to work on it, otherwise I'd put it onto our list for the next Coding 🧑‍💻 Session (you're welcome to join if you wish)?

Comment thread src/imcflibs/imagej/omerotools.py Resolved
Comment thread src/imcflibs/imagej/omerotools.py Resolved
Comment thread src/imcflibs/imagej/omerotools.py Resolved
@loicsauteur

Copy link
Copy Markdown
Author

I'd welcome the opportunity to join one of your coding sessions and work on this.

As I am not really used to working on a collaborative project, I'm happy about the pointers and how-to. E.g.:

  • how-to comment on a commit with more than the commit message

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.50000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 35%. Comparing base (d05df2b) to head (8fde7eb).
⚠️ Report is 2 commits behind head on devel.

Files with missing lines Patch % Lines
src/imcflibs/imagej/omerotools.py 78% 9 Missing ⚠️
Additional details and impacted files
@@         Coverage Diff          @@
##           devel   #157   +/-   ##
====================================
+ Coverage     33%    35%   +3%     
====================================
  Files         25     25           
  Lines       1806   1823   +17     
====================================
+ Hits         591    645   +54     
+ Misses      1215   1178   -37     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@loicsauteur
loicsauteur force-pushed the fix-omerotools branch 2 times, most recently from 8c5ac37 to 87f5674 Compare October 14, 2026 10:09
@ehrenfeu ehrenfeu added this to the 2.0.0 milestone Oct 14, 2026
@ehrenfeu ehrenfeu added bug Something isn't working unit testing A unit test should be created labels Oct 14, 2026
@ehrenfeu ehrenfeu moved this to In progress in IMCF-Fiji Oct 14, 2026
Removed 'image_ids = ...' is immediately overwriten by the subsequent line. Removed lines ('image-' URL handling) are handled in the 'elif'  before.
Clarified that it works for Dataset IDs or Image IDs URLs. Removed that it handles Dataset IDs directly (which it does not to my knowledge.
Fixed 'anotations' -> 'annotations' twice in function descriptions
Import image did not raise file error if it did not exist.
This function is part the refactoring of parse_url. It takes an URL and OMERO type to return a list of string IDs. Along with a test.
This function is part the refactoring of parse_url. It takes an URL and return a list of string IDs and the OMERO type (Project, Dataset or ID). Along with a test.
The string handling of parse_url happens now in other functions. The logic stays the same. In addition, it raises an NotImplementedError for Project-URLs.
@loicsauteur

Copy link
Copy Markdown
Author

I added the refactoring of the parse_url:

2 additional functions with their tests (in test_omerotools.py)

I also added a very basic test function for parse_url itself, but it only tests the first part of the function (for the expected risen errors).

Important: I have not tested the modified parse_url function in Fiji or similar...

@ehrenfeu

Copy link
Copy Markdown
Member

Thanks @loicsauteur for the updates! I ran the CI checks now (this will happen automatically once your first PR is merged into the repository) and two of them are failing:

Linting

That's due to one of the parameters not being explained in the function's docstring.

Python 2 Tests

This is caused by using statements that are Python 3 only (which explains why the Pytest-Poetry test ran fine, unlike this one). Remember, the syntax needs to be Python 2.7 compatible as the Fiji-Jython is still on that language version (and will probably never be different). Convenient things like f-strings do not yet exist in 2.7.

@loicsauteur

loicsauteur commented Oct 15, 2026 •

Copy link
Copy Markdown
Author

Thanks @loicsauteur for the updates! I ran the CI checks now (this will happen automatically once your first PR is merged into the repository) and two of them are failing:

Linting

That's due to one of the parameters not being explained in the function's docstring.

Python 2 Tests

This is caused by using statements that are Python 3 only (which explains why the Pytest-Poetry test ran fine, unlike this one). Remember, the syntax needs to be Python 2.7 compatible as the Fiji-Jython is still on that language version (and will probably never be different). Convenient things like f-strings do not yet exist in 2.7.

Thanks @ehrenfeu:

Yes, I just tried to test in Fiji and ran into an error...

I will lint (did not work with the PyCharm plugin), and check that it is compatible with Python 2.7 🙄.

@ehrenfeu

Copy link
Copy Markdown
Member

Linting 🕵️ is fine now ✅ but the Python 2 🐍🐍 test is still failing:

>       with pytest.raises(FileNotFoundError, match=r"Could not find file"):
E       NameError: global name 'FileNotFoundError' is not defined

@loicsauteur

Copy link
Copy Markdown
Author

Linting 🕵️ is fine now ✅ but the Python 2 🐍🐍 test is still failing:

>       with pytest.raises(FileNotFoundError, match=r"Could not find file"):
E       NameError: global name 'FileNotFoundError' is not defined

Yes, saw it.

Python 2.7 isn't really groovy 😉

@loicsauteur

loicsauteur commented Oct 15, 2026 •

Copy link
Copy Markdown
Author

OK. I added also interactive-imagej test scripts and tested them.

It is really cool and great that you have those CI workflows!

And also the documentation in the project!

@ehrenfeu
ehrenfeu changed the base branch from master to devel October 16, 2026 20:48
@rohangirishrao rohangirishrao modified the milestones: 2.0.0, 2.1.0 Nov 11, 2026
@ehrenfeu
ehrenfeu merged commit e994252 into imcf:devel Nov 11, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in IMCF-Fiji Nov 11, 2026
@loicsauteur
loicsauteur deleted the fix-omerotools branch November 11, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working unit testing A unit test should be created

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants