Hello everyone! Me and <@U04N7K4LKKL> came across ...
# tools
b
Hello everyone! Me and @Felix Lenner came across a bug where the pipeline linting for
modules.json
fails if only subworkflows (and no modules) are installed from a repository. So we put together a fix to add support for this situation and improve the linting error messages returned - PR: Fix linting for modules.json to add support for only installing subworkflows from a repository. Could anyone take a look at the PR and let us know what you think? 🙂
✏️ 1
@mashehu Could I ask you for some help with making the tests? As far as I understand, the current test uses a
lint_obj
that is essentially created from a pipeline generated from the template itself. https://github.com/nf-core/tools/blob/b6c5737fde996c824b87d19d1c51a29b4810db1d/tests/pipelines/lint/test_modules_json.py#L6 That means that there are no specific fixtures for
modules.json
files that we could alter to simulate the different conditions. How would you go about creating tests with this setup? 🤔
Should we, in the test code, modify the
modules.json
file from
<http://self.wf|self.wf>_path
?
m
have a look at the
test_mod_json_with_empty_modules_value
test in
test_modules_json.py
that does already the modification for modules.json. but for your PR we should also remove all files in
modules/nf-core
to have the modules directory and modules.json correctly in sync.
b
Ah nice! Thanks a bunch! I'll take a look and get back to you when I have cooked something up! 🙂
m
sure, thanks for your work! if you get stuck too deep or run out of time, let me know and I can take over
b
Alright, I've gotten stuck and this is maybe something that would be fast for you to figure out so I'll try asking! 🙂 Given the example you mentioned, I tried to create a
mod_json_obj
with only "workflows" entries for all repos. But how can this be fed into the
lint_obj
to then run
self.lint_obj.modules_json()
?
m
oh, I am sorry, I was thinking of the wrong file. for
tests/pipelines/lint/test_modules_json.py
have a look at https://github.com/nf-core/tools/blob/dev/tests/pipelines/lint/test_nfcore_yml.py where we change elements in the yml and then reread it in linting. you should be able to do something similar with the modules.json file. Sorry again for pointing you in the wrong way
b
Ah thank you!!! I made something up but it turns out that writing the dict to the modules.json file was the only thing that was actually necessary to fix my previous problem so I might have overengineered the solution! 😅 Could you give another look to the PR and see what you think so far? I've now added a
test_modules_json_with_only_subworkflow_entries
and am planning to add a
test_modules_json_empty_file_fail
. Let me know if you think more conditions should be checked!
Also, could I get some help with the CI check error? 🤔