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

nf-test module/subworkflow lint #2494

Merged
merged 8 commits into from
Oct 31, 2023
Merged

Conversation

nvnieuwk
Copy link
Contributor

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

@nvnieuwk nvnieuwk changed the base branch from master to dev October 25, 2023 13:34
@nvnieuwk
Copy link
Contributor Author

Related to #2474

@nvnieuwk nvnieuwk requested review from mashehu and mirpedrol October 25, 2023 13:36
@nf-core nf-core deleted a comment from github-actions bot Oct 25, 2023
@nvnieuwk
Copy link
Contributor Author

This PR is needed to complete the nf-test linting implementation in nf-core/modules#4231

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #2494 (73831ae) into dev (a2d69af) will decrease coverage by 0.12%.
The diff coverage is 30.33%.

@@            Coverage Diff             @@
##              dev    #2494      +/-   ##
==========================================
- Coverage   70.62%   70.50%   -0.12%     
==========================================
  Files          88       88              
  Lines        9493     9515      +22     
==========================================
+ Hits         6704     6709       +5     
- Misses       2789     2806      +17     
Files Coverage Δ
nf_core/modules/lint/module_tests.py 65.38% <64.28%> (-5.35%) ⬇️
nf_core/subworkflows/lint/subworkflow_tests.py 11.86% <0.00%> (-2.72%) ⬇️

Copy link
Contributor

@edmundmiller edmundmiller left a comment

Choose a reason for hiding this comment

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

I think we should just warn for now, and then we can turn the failure on once we have all the infrastructure in place, and we're fully deprecating the pytest-workflow tests.

https://github.com/orgs/nf-core/projects/43/views/5 should have all the stuff that we need done.

if os.path.exists(module.test_dir):
module.passed.append(("test_dir_exists", "Test directory exists", module.test_dir))
else:
module.failed.append(("test_dir_exists", "Test directory is missing", module.test_dir))
module.failed.append(("test_dir_exists", "nf-test directory is missing", nftest_testdir))
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this throw a failure or a warning? I'm fine if we want to really push the hard shift, but I think just a warning for now might be the right direction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will throw two failures right now, but yeah I agree maybe the nf-test failure should be a warning. I'll try to figure out how to do that :p

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allright fixed!

subworkflow.passed.append(("test_main_exists", "test `main.nf` exists", subworkflow.test_main_nf))
else:
subworkflow.failed.append(("test_main_exists", "test `main.nf` does not exist", subworkflow.test_main_nf))
subworkflow.failed.append(("test_main_exists", "test `main.nf.test` does not exist", nftest_main_nf))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, warn for now, maybe toss a TODO in there.

@nvnieuwk
Copy link
Contributor Author

Thanks for the review @emiller88! Currently the main logic still works as before but now it checks for the presence of nf-test tests too and doesn't throw the pytest failures if they are present

if os.path.exists(module.test_dir):
module.passed.append(("test_dir_exists", "Test directory exists", module.test_dir))
else:
module.failed.append(("test_dir_exists", "Test directory is missing", module.test_dir))
module.warned.append(("test_dir_exists", "nf-test directory is missing", nftest_testdir))
Copy link
Member

Choose a reason for hiding this comment

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

The nf-test warning should be moved to the else after checking if nf-test dir exists.
Or use if/elif/else otherwise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was a typo 😁 The second if statement should have been elif :p

Copy link
Member

@mirpedrol mirpedrol left a comment

Choose a reason for hiding this comment

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

Only one small comment, otherwise looks good! I also agree with warning until we finish with all the implementation :)

@nvnieuwk nvnieuwk enabled auto-merge October 26, 2023 09:38
@nvnieuwk
Copy link
Contributor Author

Thanks @mirpedrol 🍪

@nvnieuwk nvnieuwk requested a review from edmundmiller October 26, 2023 12:13
Copy link
Contributor

@edmundmiller edmundmiller left a comment

Choose a reason for hiding this comment

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

Awesome! LGTM!

@nvnieuwk nvnieuwk merged commit b38c0f6 into nf-core:dev Oct 31, 2023
19 checks passed
@nvnieuwk nvnieuwk deleted the nf-test-module-lint branch October 31, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants