flowcraft icon indicating copy to clipboard operation
flowcraft copied to clipboard

unit tests for scripting templates

Open tiagofilipe12 opened this issue 6 years ago • 2 comments

Now that we removed the dependency on the submodule and have the python templates within the repo, maybe we should start thinking in adding unit tests for some of the scripts that are used within a given nextflow template. This would be nice to assure that we don't break any part of the code that is required, after updating the module for some reason. For instance, I need that the object returned from the plasmid modules return a given json file so that it can be loaded into patlas.site. But others may have other reasons or just to maintain a healthier code that others can contribute in the future.

tiagofilipe12 avatar Oct 13 '18 22:10 tiagofilipe12

Started playing around with these tests and it will require a little handling on the imports, since the relative path for the imports is different from the templates.

Previous import:

from flowcraft_utils.flowcraft_base import get_logger, MainWrapper

In order to work within the tests folder:

try:
    from flowcraft_utils.flowcraft_base import get_logger, MainWrapper
except ImportError:
    from flowcraft.templates.flowcraft_utils.flowcraft_base import get_logger, MainWrapper

tiagofilipe12 avatar Oct 15 '18 20:10 tiagofilipe12

List of templates that have tests:

  • [ ] assembly_report.py
  • [ ] downsample_fastq.py
  • [ ] fasta_spliter.py (this isn't being used as a template but rather executed within the nextflow process)
  • [ ] fastqc.py
  • [ ] fastqc_report.py
  • [ ] integrity_coverage.py
  • [x] mapping2json.py
  • [x] mashdist2json.py
  • [x] mashscreen2json.py
  • [ ] megahit.py
  • [ ] metaspades.py
  • [x] pATLAS_consensus_json.py
  • [ ] pipeline_report.py
  • [ ] process_abricate.py
  • [ ] process_assembly.py
  • [ ] process_assembly_mapping,py
  • [ ] process_mapping.py
  • [ ] process_newick.py
  • [ ] process_viral_assembly.py
  • [ ] skesa.py
  • [ ] spades.py
  • [ ] split_fasta.py
  • [ ] trimmomatic.py
  • [ ] trimmomatic_report.py

tiagofilipe12 avatar Nov 05 '18 13:11 tiagofilipe12