Skip to content

WIP fix: cannot unpack non-iterable NoneType object from #3365#3496

Closed
Hocnonsense wants to merge 4 commits intomainfrom
test/issue3495
Closed

WIP fix: cannot unpack non-iterable NoneType object from #3365#3496
Hocnonsense wants to merge 4 commits intomainfrom
test/issue3495

Conversation

@Hocnonsense
Copy link
Copy Markdown
Contributor

@Hocnonsense Hocnonsense commented Mar 31, 2025

This is the testcase of #3495

QC

  • The PR contains a test case for the changes.
  • The documentation (docs/) havn't updated to reflect the changes.

Summary by CodeRabbit

  • New Features

    • Introduced a new automated process that dynamically generates a custom output file with updated content and tailored parameters, streamlining workflow execution.
  • Tests

    • Added a new test case to verify the automation process, ensuring robust and reliable performance across supported environments with platform-specific considerations.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 31, 2025

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • tests/test_issue3495/expected-results/one.txt

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This pull request introduces a new Snakefile in the tests/test_issue3495 directory that defines a rule called one responsible for generating an output file (one.txt) using a shell command. The rule is also aliased as two in the same file with specific parameters. Additionally, the expected output file (one.txt) is updated with new content, and a new test function test_issue3495 is added to tests/tests.py to execute the test, with a decorator to skip execution on Windows.

Changes

File(s) Change Summary
tests/test_issue3495/Snakefile, tests/test_issue3495/expected-results/one.txt Added a new Snakefile rule one (aliased as two) that uses a shell command to generate an output file and updated the expected result file with new content "c1".
tests/tests.py Introduced a new test function test_issue3495 decorated with @skip_on_windows, which runs the test using the directory test_issue3495.

Sequence Diagram(s)

sequenceDiagram
    participant T as Test Runner (tests/tests.py)
    participant S as Snakefile Rule "one"
    participant C as Shell Command
    participant O as Output File (one.txt)

    T->>S: Trigger rule execution (via test_issue3495)
    S->>C: Execute shell command (echo parameters)
    C->>O: Write output ("one.txt") with result (e.g., "goor job")
    T->>T: Validate output against expected result ("c1")
Loading

Suggested reviewers

  • johanneskoester

🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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
Copy Markdown
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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17f0d9b and 83f6048.

📒 Files selected for processing (3)
  • tests/test_issue3495/Snakefile (1 hunks)
  • tests/test_issue3495/expected-results/one.txt (1 hunks)
  • tests/tests.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.py`: Do not try to improve formatting. Do not suggest type annotations for functions that are defined inside of functions or methods. Do not suggest type annotation of the `s...

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

  • tests/tests.py
🧬 Code Definitions (1)
tests/tests.py (2)
tests/common.py (2)
  • run (151-494)
  • dpath (32-35)
src/snakemake/workflow.py (1)
  • run (2264-2265)
⏰ Context from checks skipped due to timeout of 90000ms (35)
  • GitHub Check: tests (10, windows-latest, py312)
  • GitHub Check: tests (10, ubuntu-latest, py312)
  • GitHub Check: tests (10, ubuntu-latest, py311)
  • GitHub Check: tests (9, windows-latest, py312)
  • GitHub Check: tests (9, ubuntu-latest, py312)
  • GitHub Check: tests (9, ubuntu-latest, py311)
  • GitHub Check: tests (8, windows-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py311)
  • GitHub Check: tests (7, windows-latest, py312)
  • GitHub Check: tests (7, ubuntu-latest, py312)
  • GitHub Check: tests (7, ubuntu-latest, py311)
  • GitHub Check: tests (6, windows-latest, py312)
  • GitHub Check: tests (6, ubuntu-latest, py312)
  • GitHub Check: tests (6, ubuntu-latest, py311)
  • GitHub Check: tests (5, windows-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py311)
  • GitHub Check: tests (4, macos-latest, py312)
  • GitHub Check: tests (4, windows-latest, py312)
  • GitHub Check: tests (4, ubuntu-latest, py312)
  • GitHub Check: tests (4, ubuntu-latest, py311)
  • GitHub Check: tests (3, macos-latest, py312)
  • GitHub Check: tests (3, windows-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py311)
  • GitHub Check: tests (2, macos-latest, py312)
  • GitHub Check: tests (2, windows-latest, py312)
  • GitHub Check: tests (2, ubuntu-latest, py312)
  • GitHub Check: tests (2, ubuntu-latest, py311)
  • GitHub Check: tests (1, macos-latest, py312)
  • GitHub Check: tests (1, windows-latest, py312)
  • GitHub Check: tests (1, ubuntu-latest, py312)
  • GitHub Check: tests (1, ubuntu-latest, py311)
  • GitHub Check: apidocs
🔇 Additional comments (4)
tests/test_issue3495/expected-results/one.txt (1)

1-2: Output file looks correct but simple.

This expected output file contains a single line with "c1", which will be used to validate the test case output.

tests/test_issue3495/Snakefile (2)

9-12: Verify the parameter override is working as expected.

The rule one is used as two with a parameter output="goor job". Since the original rule uses {params} in the shell command without specifying which parameter to access, it's unclear how this parameter will be used. Is the intention that {params} should evaluate to "goor job" when used in this context?


1-7:

Details

❓ Verification inconclusive

Rule definition has potential issue with params usage.

The shell command references {params} but there's no params: section defined in the rule. This could be intentional if you're testing how the Snakemake workflow handles this situation (perhaps related to the "cannot unpack non-iterable NoneType object" issue mentioned in the PR title).


🏁 Script executed:

#!/bin/bash
# Check if the Snakefile works as expected
cd tests/test_issue3495
snakemake -n

Length of output: 140


Action Required: Verify {params} Usage in the Snakefile Rule

In the rule defined in tests/test_issue3495/Snakefile (lines 1-7), the shell command references {params} even though no params: section is provided. This may be intentional—possibly as part of testing for the "cannot unpack non-iterable NoneType object" error—but it's unclear from the current evidence.

Our initial test execution did not provide useful feedback because the Snakemake command was not found in the environment:

+ cd tests/test_issue3495
+ snakemake -n
/.coderabbit_commands_59794b0a-6e19-47f9-b84f-c45dfa2110ac.sh: line 4: snakemake: command not found

Next Steps:

  • Manual Verification: Please verify the behavior with Snakemake installed to determine if the missing params: section results in a runtime error or if it is working as intended.
  • Rule Adjustment: If the behavior is unexpected, consider either adding a params: section or updating the shell command to remove the unused {params} reference.
tests/tests.py (1)

2249-2252: Test function looks appropriate for issue #3495.

The new test function follows the same pattern as other test functions in this file. It's decorated with @skip_on_windows and calls run() with the path to the test directory.

Comment thread tests/test_issue3495/Snakefile Outdated
output="goor job",


print(UseRuleWith.INHERIT)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing import for UseRuleWith.

The code references UseRuleWith.INHERIT but there's no import statement for this symbol. Make sure it's properly imported from the appropriate module.

+from snakemake.common.rules import UseRuleWith
 
 rule one:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
print(UseRuleWith.INHERIT)
from snakemake.common.rules import UseRuleWith
print(UseRuleWith.INHERIT)
rule one:
# Rest of the rule goes here

johanneskoester pushed a commit that referenced this pull request Jun 16, 2025
### Description

Follow-up change on merged PR #3624 , inspired by suggested PR #3496
(probs to @Hocnonsense ).

### QC

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved handling of rule parameters to prevent errors when parameters
are missing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@johanneskoester
Copy link
Copy Markdown
Contributor

Thanks! We missed this and fixed it in parallel. But your solution provides a follow up that is even better than @schrins in initial one. Merged in #3627.

@Hocnonsense Hocnonsense deleted the test/issue3495 branch June 16, 2025 12:13
kjohnsen pushed a commit to kjohnsen/snakemake that referenced this pull request Dec 15, 2025
### Description

Follow-up change on merged PR snakemake#3624 , inspired by suggested PR snakemake#3496
(probs to @Hocnonsense ).

### QC

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved handling of rule parameters to prevent errors when parameters
are missing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@Hocnonsense Hocnonsense self-assigned this Mar 18, 2026
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.

2 participants