8000 ci: Fix tests for napari from repository by Czaki · Pull Request #1148 · 4DNucleome/PartSeg · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ci: Fix tests for napari from repository #1148

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

Merged
merged 15 commits into from
Jul 17, 2024
Merged

ci: Fix tests for napari from repository #1148

merged 15 commits into from
Jul 17, 2024

Conversation

Czaki
Copy link
Collaborator
@Czaki Czaki commented Jul 15, 2024

Summary by CodeRabbit

  • New Features

    • Added support for napari version 0.5.0.
    • Introduced new environment configuration for napari5.
  • Bug Fixes

    • Updated test configurations to ensure compatibility with PySide6 and other Python versions.
    • Improved handling of edit_request signals in the Colormap Creator.
  • Chores

    • Adjusted GitHub workflow triggers and updated Python version matrix.
    • Refined test skipping markers for PySide6 to enhance test management.

@Czaki Czaki added this to the 0.15.4 milestone Jul 15, 2024
Copy link
Contributor
coderabbitai bot commented Jul 15, 2024

Walkthrough

The updates encompass various components, highlighting significant enhancements and refinements. Key changes include adding support for Python 3.12 in workflows, refining dependencies and test commands in tox.ini, updating markers and decorators for test skipping in specific configurations, and refining signal handling in the ColormapPreview class. These changes aim to improve compatibility, facilitate testing, and enhance functionality and maintainability in the project.

Changes

File/Path Summary
.github/workflows/test_napari_repo.yml Added pull_request trigger, updated Python matrix to include version 3.12.
.github/workflows/test_napari_widgets.yml Updated napari version from 0.4.19 to 0.5.0 for testing with Python 3.10.
tox.ini Added napari5 environment, updated PySide6 dependency with version constraints, modified dependency specs, and adjusted test commands for napari repository.
pyproject.toml Updated markers to skip tests for pyside2 and pyside6 Qt backends.
package/tests/conftest.py Added a check to skip tests with marker pyside6_skip when qtpy.API_NAME is PySide6.
package/tests/test_PartSeg/test_base_widgets.py Added @pytest.mark.pyside6_skip() decorator to skip test_napari_viewer_additional_layers with PySide6.
package/PartSeg/common_gui/colormap_creator.py Split edit_request signal into edit_request_name and edit_request_colormap, and updated corresponding connections.

Sequence Diagram(s)

No sequence diagrams are generated for this set of changes as they primarily involve configuration updates, dependency management, and minor code adjustments rather than significant new features or control flow modifications.

Poem

In lines of code so neat and bright,
Python 3.12 joins the fight.
Napari's versions, updated with care,
Signals split, dependencies fair.
With tests refined and markers set,
Our project shines without regret.
CodeRabbit hops, in joy, we cheer,
For better code, the path is clear! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor
sourcery-ai bot commented Jul 15, 2024

🧙 Sourcery has finished reviewing your pull request!


Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor
@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 052bf57 and 189d8ac.

Files selected for processing (2)
  • .github/workflows/test_napari_repo.yml (2 hunks)
  • tox.ini (2 hunks)
Additional comments not posted (4)
.github/workflows/test_napari_repo.yml (2)

8-12: Added pull_request trigger for specific paths.

This change ensures that the workflow is triggered for pull requests that modify critical paths, enhancing the CI process by ensuring relevant tests are run when these files are changed.


37-37: Expanded Python version matrix to include 3.12.

This change ensures that the workflow tests against the latest Python version, which is crucial for maintaining compatibility and catching issues early.

tox.ini (2)

42-42: Updated PySide6 dependency specification.

This change is a straightforward update to the PySide6 dependency, likely to address compatibility issues or new features in PySide6.


74-87: Updated environment configurations and commands for different napari versions.

This comprehensive update includes:

  • Addition of napari version 0.5.0 in the testing matrix.
  • Adjustments to the dependency specifications for different napari versions.
  • Modification of test commands based on whether the napari repository is present.

These changes are crucial for ensuring that the testing environments are accurately configured to test against multiple versions of napari, which is essential for compatibility testing.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 189d8ac and 49f430d.

Files selected for processing (1)
  • tox.ini (2 hunks)
Additional comments not posted (2)
tox.ini (2)

42-43: Update PySide6 version constraints based on Python version.

The conditional version constraints for PySide6 are correctly updated to handle different Python versions. This ensures compatibility and prevents potential issues with newer Python releases.


75-88: Review updated test environments and commands.

The test environment configurations and commands have been updated to include a new napari version (napari_5) and to reflect the renaming of napari version identifiers. These changes are consistent with the PR objectives to fix tests related to the napari repository.

  • Python Version and Dependency Management: The addition of Python 3.12 in the test matrix is a forward-looking change that prepares the testing infrastructure for future Python releases.
  • Dependency Constraints: The use of pydantic<2 for specific napari versions suggests careful management of dependencies to avoid potential compatibility issues.
  • Test Commands: The differentiation in test commands between napari_repo and other versions is logical, allowing for more comprehensive testing when working directly with the napari repository.

Overall, these updates are well-structured and seem to align with best practices for maintaining a robust testing environment.

@Czaki Czaki changed the title ci: Fix napari repo tests ci: Fix tests for napari from repository Jul 15, 2024
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 49f430d and 4369d9f.

Files selected for processing (1)
  • .github/workflows/test_napari_repo.yml (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test_napari_repo.yml

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4369d9f and 302fd3e.

Files selected for processing (5)
  • .github/workflows/test_napari_widgets.yml (1 hunks)
  • package/tests/conftest.py (1 hunks)
  • package/tests/test_PartSeg/test_base_widgets.py (1 hunks)
  • pyproject.toml (1 hunks)
  • tox.ini (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • tox.ini
Additional comments not posted (4)
.github/workflows/test_napari_widgets.yml (1)

30-30: Update to Napari version approved, but verify compatibility.

The update from "napari419" to "napari5" is noted. While this change is approved, it's crucial to verify that "napari5" is compatible with the existing dependencies and does not introduce any breaking changes.

package/tests/test_PartSeg/test_base_widgets.py (1)

109-109: Decorator to skip tests on PySide6 added.

The addition of @pytest.mark.pyside6_skip() is approved. However, it's important to document the reasons for skipping these tests when using PySide6 to maintain clarity for future maintenance.

pyproject.toml (1)

208-209: Markers for skipping tests based on Qt backend added.

The addition of pyside_skip and pyside6_skip markers is approved. It's important to verify that these markers are utilized correctly throughout the test suite to ensure they function as intended.

Verification successful

Markers for skipping tests based on Qt backend added.

The addition of pyside_skip and pyside6_skip markers is approved. The markers are correctly utilized throughout the test suite to ensure they function as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of new test markers in the test suite.

# Test: Search for usage of the new markers in test files.
rg --type py -A 5 $'pyside_skip|pyside6_skip'

Length of output: 10216

package/tests/conftest.py (1)

284-288: Logic to skip tests based on PySide6 added.

The addition of logic to skip tests when qtpy.API_NAME is "PySide6" is noted and approved. It's important to verify that this logic works as intended and does not interfere with other test configurations.

Verification successful

Logic to skip tests based on PySide6 added.

The addition of logic to skip tests when qtpy.API_NAME is "PySide6" is correctly implemented. The pyside6_skip marker is properly referenced in the codebase, and the logic does not interfere with other test configurations.

  • pyproject.toml: Definition of pyside6_skip marker.
  • package/tests/conftest.py: Implementation of the logic to skip tests.
  • package/tests/test_PartSeg/test_base_widgets.py: Usage of the pyside6_skip marker.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new test skipping logic in action.

# Test: Run tests to ensure they are skipped as expected under PySide6.
pytest -k "pyside6_skip" --collect-only

Length of output: 113


Script:

#!/bin/bash
# Search for the usage of the 'pyside6_skip' marker in the codebase to ensure it is correctly implemented.

# Find occurrences of 'pyside6_skip' in the codebase
rg 'pyside6_skip'

# Verify the logic in 'conftest.py' to ensure it does not interfere with other configurations
rg 'def ' package/tests/conftest.py -A 10

Length of output: 8365

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 302fd3e and 39ffa5e.

Files selected for processing (1)
  • package/tests/test_PartSeg/test_base_widgets.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package/tests/test_PartSeg/test_base_widgets.py

Copy link
codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.03%. Comparing base (e734ebe) to head (37163c9).
Report is 52 commits behind head on develop.

Files with missing lines Patch % Lines
package/PartSeg/common_gui/colormap_creator.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1148      +/-   ##
===========================================
+ Coverage    93.02%   93.03%   +0.01%     
===========================================
  Files          207      207              
  Lines        32705    32700       -5     
===========================================
- Hits         30425    30424       -1     
+ Misses        2280     2276       -4     

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

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 39ffa5e and 1038b90.

Files selected for processing (1)
  • package/tests/test_PartSeg/test_base_widgets.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package/tests/test_PartSeg/test_base_widgets.py

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
package/PartSeg/common_gui/colormap_creator.py (1)

423-425: Check signal connections in ChannelPreview.__init__.

The connection logic for edit_request_name and edit_request_colormap is correctly implemented. However, ensure that the conditions under which the edit_btn is disabled (i.e., when colormap.controls length is less than 20) are explicitly documented to avoid confusion.

+ # Disable edit button if the number of controls in the colormap is less than 20
  if len(colormap.controls) < 20:
      self.edit_btn.clicked.connect(partial(self.edit_request_colormap.emit, colormap))
      self.edit_btn.setToolTip("Create colormap base on this")
  else:
      self.edit_btn.setDisabled(True)
      self.edit_btn.setToolTip("This colormap is not editable")
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1038b90 and 8ebe774.

Files selected for processing (2)
  • package/PartSeg/common_gui/colormap_creator.py (4 hunks)
  • package/tests/conftest.py (1 hunks)
Additional comments not posted (2)
package/tests/conftest.py (1)

290-294: Ensure proper skipping of tests based on Qt backend.

The code correctly checks for the "pyside6_skip" marker and skips the test if the Qt backend is PySide6. This change aligns with the PR's goal to improve CI testing compatibility.

package/PartSeg/common_gui/colormap_creator.py (1)

384-385: Properly split edit request signals for clarity.

The signals edit_request_name and edit_request_colormap are well-defined, enhancing modularity and clarity in signal handling. This change supports better separation of concerns, allowing distinct handling for name and colormap modifications.

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8ebe774 and 15c2c36.

Files selected for processing (1)
  • tox.ini (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • tox.ini

Copy link

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 15c2c36 and 37163c9.

Files selected for processing (1)
  • tox.ini (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • tox.ini

@Czaki Czaki merged commit a1f0bc6 into develop Jul 17, 2024
64 of 65 checks passed
@Czaki Czaki deleted the fix_napari_repo_tests branch July 17, 2024 08:39
@coderabbitai coderabbitai bot mentioned this pull request Oct 17, 2024
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.

1 participant
0