def test_swarm_notexec():
    """Error thrown if swarm not executable"""
    try:
        cluster = swarm.Swarm("LICENSE")
    except NotExecutableError:
        return True
    else:
        return False
def test_swarm_exec_notexist():
    """Error thrown if swarm executable does not exist"""
    try:
        cluster = swarm.Swarm(os.path.join(".", "swarm"))
    except NotExecutableError:
        return True
    else:
        return False
예제 #3
0
def test_metapy_exec_notexist():
    """Error thrown if metapy.py executable does not exist"""
    try:
        # using swarm module here just to check it is present
        cluster = swarm.Swarm(os.path.join(".", "metapy.py"))
    except NotExecutableError:
        return True
    else:
        return False
def test_swarm_exec():
    """swarm clusters test data"""
    cluster = swarm.Swarm("swarm")

    parameters = swarm.Parameters(t=1, d=1)
    result = cluster.run(INFILE, OUTDIR, parameters)

    parser = swarm.SwarmParser()
    target = parser.read(TARGET)
    swarms = parser.read(result.outfilename)
    assert_equal(target, swarms)
def test_swarm_exec():
    """Run swarm on test data

    TODO: We need a Swarm parser. Members of a group may be reported in any
          order, so we cannot rely on output files being identical on all
          systems, or after all runs.
    """
    cluster = swarm.Swarm("swarm")
    try:
        shutil.rmtree(OUTDIR)
    except FileNotFoundError:
        pass
    os.makedirs(OUTDIR, exist_ok=True)

    parameters = swarm.Parameters(t=1, d=1)
    result = cluster.run(INFILE, OUTDIR, parameters)

    parser = swarm.SwarmParser()
    target = parser.read(TARGET)
    swarms = parser.read(result.outfilename)
    print('\n'.join([', '.join(c.amplicons) for c in target.swarms]))
    print('\n'.join([', '.join(c.amplicons) for c in swarms.swarms]))
    print(target == swarms)
예제 #6
0
def test_metapy():
    """metapy instantiates with cmd-line if metapy.py is in $PATH"""
    # using swarm module here just to check it is present
    cluster = swarm.Swarm("metapy.py")
def test_swarm_cmd():
    """swarm instantiates and returns correct form of cmd-line"""
    cluster = swarm.Swarm("swarm")
    target = ' '.join(["swarm -t 1 -d 1", "-o {0}".format(OUTFILE), INFILE])
    parameters = swarm.Parameters(t=1, d=1)
    assert_equal(cluster.run(INFILE, OUTDIR, parameters, dry_run=True), target)
def test_swarm():
    """swarm instantiates with cmd-line if swarm is in $PATH"""
    cluster = swarm.Swarm("swarm")
def test_swarm():
    """swarm executable is in $PATH"""
    cluster = swarm.Swarm("swarm")