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

Add tests for XML writer #13

Merged
merged 2 commits into from
Mar 29, 2022
Merged

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Mar 14, 2022

This should fix #10 (the XML writers not working), and adds associated tests.

Note that the XML "multiple file" writer works fine for writing a single file to (as far as I can tell from local testing), so to reduce code duplication and the number of options in the plugin menu I've removed the "single file" writer.

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/brainglobe/brainglobe-napari-io/13

@dstansby dstansby changed the title Xml write tests Add tests for XML writer Mar 15, 2022
@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/brainglobe/brainglobe-napari-io/13

@dstansby dstansby marked this pull request as ready for review March 15, 2022 11:42
@dstansby dstansby requested review from adamltyson and a team March 15, 2022 11:42
@adamltyson
Copy link
Member

This has fixed saving of a single layer to xml, but the multiple layer writing (e.g. >1 points layer to a single XML file) still seems to be broken for me.

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/brainglobe/brainglobe-napari-io/13

@dstansby
Copy link
Member Author

Thanks for testing. I've refactored the code a bit to reduce duplication, and it seems to be working for me locally. @adamltyson could you check again? The tests failing are unrelated, and fixed in #15

@adamltyson
Copy link
Member

Maybe I mistyped on my last comment, because now I can save multiple layers, but not a single layer. I get:

No data written! There may be no plugins capable of writing these 1 layers to /home/adam/Desktop/test_single_layer.xml.

@dstansby
Copy link
Member Author

I can reproduce that. The multiple writer seems capable of saving data from a single layer though (at least from local tests), so I'd propose that we remove the single layer writer and have just one points writer that can hangle both single and multiple layers?

@codecov-commenter
Copy link

codecov-commenter commented Mar 16, 2022

Codecov Report

Merging #13 (a094f12) into master (f928de0) will increase coverage by 14.31%.
The diff coverage is 85.18%.

@@             Coverage Diff             @@
##           master      #13       +/-   ##
===========================================
+ Coverage   23.55%   37.86%   +14.31%     
===========================================
  Files          12       12               
  Lines         276      272        -4     
===========================================
+ Hits           65      103       +38     
+ Misses        211      169       -42     
Impacted Files Coverage Δ
brainglobe_napari_io/plugins.py 0.00% <0.00%> (ø)
brainglobe_napari_io/cellfinder/writer_xml.py 85.71% <78.57%> (+85.71%) ⬆️
...ainglobe_napari_io/tests/test_cellfinder_writer.py 100.00% <100.00%> (ø)
brainglobe_napari_io/cellfinder/utils.py 86.48% <0.00%> (+21.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f928de0...a094f12. Read the comment docs.

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/brainglobe/brainglobe-napari-io/13

@adamltyson
Copy link
Member

Yep, I'm not sure why there are multiple writers (maybe old npe?). As long as N cell layers can be saved to a single xml file that's fine.

Comment on lines +19 to +21
paths = writer_xml.write_multiple_points_to_xml(
str(tmpdir / "multiple.xml"), layers
)

Choose a reason for hiding this comment

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

I assume this method can't handle Path objects?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it should be able to. The file will eventually just be opened with open.

@dstansby dstansby merged commit 534926b into brainglobe:master Mar 29, 2022
@dstansby dstansby deleted the xml-write-tests branch March 29, 2022 09:20
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.

XML writer plugins don't work
4 participants