def test_flash_notexec():
    """Error thrown if flash exe not executable"""
    try:
        obj = flash.Flash("LICENSE")
    except NotExecutableError:
        return True
    else:
        return False
def test_flash_exec_notexist():
    """Error thrown if flash executable does not exist"""
    try:
        obj = flash.Flash(os.path.join(".", "flash"))
    except NotExecutableError:
        return True
    else:
        return False
def test_flash_cmd():
    """flash instantiates, runs and returns correct form of cmd-line"""
    obj = flash.Flash("flash")
    target = ' '.join(["flash", "--max-overlap", "250",
                       "--threads", "4", "-o", os.path.join(OUTDIR, PREFIX),
                       READS1, READS2])
    assert_equal(obj.run(READS1, READS2, 4, OUTDIR, PREFIX, dry_run=True),
                 target)
def test_flash_exec():
    """Run flash on test data and compare output to precomputed target
    this often does not produce the same result twice. So we may have
    to disable this test"""
    obj = flash.Flash("flash")
    result = obj.run(READS1, READS2, 4, OUTDIR, PREFIX, dry_run=False)
    # call function to sort the data. returned as a sorted(set)
    # the flash output is not sorted, so a direct comparason of the file
    # does not work. So have to sort first.
    targed_data_sorted = sort_flash_output(TARGET)
    # outfileextended - name from named tuple and originally
    # from build_command
    test_data_sorted = sort_flash_output(result.outfileextended)
    assert_equal(targed_data_sorted, test_data_sorted)
def test_flash():
    """flash instantiates with cmd-line if flash is in $PATH"""
    assemble = flash.Flash("flash")