What are our current feelings on adding small test...
# team-maintainers
s
What are our current feelings on adding small test files (e.g. yml files) that are only used in a single module to the
tests
folder? For instance: https://github.com/nf-core/modules/pull/9660/files
๐Ÿ‘Ž๐Ÿป 1
๐Ÿ‘ 2
๐Ÿ‘Ž 2
j
Iโ€™m fine with it. Alternatively you could write the file to a temporary disk location directly in the nf-test script with some Groovy
this 3
j
I'm still personally against it, for file pollution reasons
I'm pro Jim's method
m
pro Jim's method too
s
Bleh, it is just harder to do that method
it is a faff
and just pollutes the main.nf.test instead
rather than adding an extra file that is much cleaner
j
I'd rather
main.nf.test
is polluted than forced pollution of my pipeline ๐Ÿ˜‰
If you really want a file put it on
test-datasets
s
test-datasets = dumpster fire
j
I'm waiting for you to go on a module-like rampage ๐Ÿ˜‰
(unfortunately I'm rampaging outside of nf-core so no capacities currently)
j
We should write a helper function in nft-utils that writes an arbitrary string to a temp file in the nf-test dir, strips the indents and returns the path.
s
or just take the easy route ๐Ÿคท
I don't get the point of making it harder to make tests
because what you get is people not bothering to make a test where they supply the yaml file or whatever config
I realise that James's argument is going to be that is fine, we should just make people work
๐Ÿ˜ฌ 1
and they'll take their medicine and it'll be good for them
j
Somewhat yes
But I also am increasingly finding it a pain to develop/review pipelines because of the sheer number of files that are added through modules
s
(only slightly hyperbolic there ๐Ÿ˜‰ )
well the tests shouldn't be added
that is the way to fix that
j
Fair
s
nobody runs the module tests
that's what I do in my private repos
j
But I seem to vaguely (mis?)remember someone requesting that they stay for regulatory reasons or something
s
then make it optional
(well, yes, I'm actually on the verge of adding them back in for regulatory reasons ๐Ÿ˜‰ )
I hate these kind of arbitrary rules that just end up with people giving up on the PR
j
Why is it arbitrary though?
We've said why: prevent file pollution
(at least what some of believe is why)
j
I wouldn't necessarily say it was any more file pollution than including a
nextflow.config
file in the test directory - some tests have multiple of those. IMO it's fine to include a test file for a module in the tests as long as: โ€ข the file format is specific to the module - e.g. a config file โ€ข it is plaintext โ€ข it is very small โ€ข you only need one! But I appreciate that not everyone would agree, hence the suggestion you could embed it in the nf-test:
Copy code
setup {
    new File("${launchDir}/test.yaml").text = """
        freq: "AF"
        depth: "DP"
        altDepth: "AD"
        maxVaf: "1"
""".stripIndent()
}

//...

process {
    """
    input[N] = file("${launchDir}/test.yaml")
    """
}
m
I also vote to get the file created from the nf-test script, possibly with an helper method from nft-utils. I think itโ€™s paramount we keep the repository tidy and this means knowing what we have and where. At scale, the cleanest is to only allow predefined file types/extensions at predefined locations โ€“ thatโ€™s what we have at the moment. That means weโ€™re able to do bulk changes when we need to. For instance, currently we can assume that all yml files are of the
meta.yaml
sort, we know the schema they need to be validated against, write CI + nf-core/tools, etc. What happens when we start adding other yml files ? Same for
.config
files. This is a very generic extension, and itโ€™s very specific to this repo to know/assume they are Nextflow config files. If any tool brings its own config file format named
dummy.config
Iโ€™m sure itโ€™ll create problems.
party this 2