uclahs-cds / tool-NFTest

CLI to automate Nextflow pipeline testing
GNU General Public License v2.0
11 stars 1 forks source link

Catch failing test cases #70

Closed nwiltsie closed 2 months ago

nwiltsie commented 2 months ago

Description

Oof, I'm almost certain this one is my doing 🤦‍♂️.

Right now the check for whether or not a test has failed always passes, as we're checking the truthiness of the CompletedProcess. This change makes it so that we properly examine the exit code:

#!/usr/bin/env python3
import subprocess

# How we're running Nextflow under the hood
with subprocess.Popen(["false"]) as process:
    pass

print("The current test... ", end="")
if not process:
    print("correctly caught the failure")
else:
    print("FAILED")

print("The updated test... ", end="")
if process.returncode != 0:
    print("correctly caught the failure")
else:
    print("FAILED")
$ python3 tester.py
The current test... FAILED
The updated test... correctly caught the failure

Checklist

[^1]: UCLA Health reaches $7.5m settlement over 2015 breach of 4.5m patient records [^2]: The average healthcare data breach costs $2.2 million, despite the majority of breaches releasing fewer than 500 records. [^3]: Genetic information is considered PHI. Forensic assays can identify patients with as few as 21 SNPs [^4]: RNA-Seq, DNA methylation, microbiome, or other molecular data can be used to predict genotypes (PHI) and reveal a patient's identity.

  To automatically exclude such files using a .gitignore file, see here for example.