nf-core / modules

Repository to host tool-specific module files for the Nextflow DSL2 community!
https://nf-co.re/modules
MIT License
276 stars 691 forks source link

Module stub that `touch .gz` break snapshots in `nf-test` #5409

Open awgymer opened 6 months ago

awgymer commented 6 months ago

Have you checked the docs?

Description of the bug

Per this slack thread it seems that empty .gz files generated by simply touch <filename>.gz break the snapshot functionality of nf-test by causing an EOFException because the files are not actually compressed.

Per this comment a fix is to replace the touch command with echo "" | gzip > <filename>.gz.

A git grep -cP "touch .*\.gz(\s+.*)*$" identifies the following 71 modules as using this pattern:

famosab commented 5 months ago

For wittyer the code in the stub test actually looks like this:

    touch ${prefix}.json
    echo "" | gzip > ${prefix}.vcf.gz
    touch ${prefix}.vcf.gz.tbi

When I tested the module using touch to create the .gz.tbi file did not lead to errors when asserting { assert snapshot(process.out).match() }, so it seems to me that you would only need to search for modules where the file extension ends with .gz.

awgymer commented 5 months ago

The list was generated before I had tested .gz.* type files. It does indeed seem that these are not an issue for nf-test (I think it does a naive check for .gz file extension before it tries opening as a gzipped file?).

I've revised the list with a regex that excludes such files.