-
Notifications
You must be signed in to change notification settings - Fork 193
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
Automating pytest migration #3138
base: dev
Are you sure you want to change the base?
Conversation
if migrate_pytest_hard and not migrate_pytest: | ||
log.error("--migrate_pytest_hard can only allowed in combination with --migrate_pytest.") | ||
sys.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just add flag --hard
to the existing command? Or indeed --force
which is more consistent with the rest of nf-core tools.
e.g. --migrate_pytest --force
instead of --migrate_pytest --migrate_pytest_hard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @adamrtalbot
I like your idea. I have also thought of not adding any additional flag at all. The code should try to extract and convert the pytest workflows by default, but if an exception is thrown, it should catch that, and revert back to the original migration scheme. That way, we also don't need to update the documentation.
However, the problem with this PR and the functionality it implements is that it is very fragile. I am using regex which cannot cover many edge cases. A more robust approach is to use a language parser such as pyPEG (https://stackoverflow.com/questions/6571964/which-tool-to-use-to-parse-programming-languages-in-python). But then we have plans to deprecate pytest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update!
Since a language parser using Antlr has now been implemented for Nextflow under the nextflow/language-server project, I am using that to create a more universal pytest
to nf-test
converter here: https://github.com/GallVp/pytest2nf-test
The converter is in its infancy but it can already tackle far more complicated cases which were out of reach by the regex approach taken by this PR. Hopefully, we'll fast-convert all the remaining pytests soon.
Hi Team
As suggested by @mashehu , I am opening this draft PR.
include
statement, as chaining is not needed.nf-core modules lint --update-assertions
or such. Lots of modules fail nf-test after their creation date because md5s are added forgz
files or log files. If we lint for power assertions and automate some of them such asnft-bam
ornft-vcf
, that will encourage good practice across modules and save people from downstream pain.