Esempio n. 1
0
def test_help():
    try:
        main.main([prog, '--help'])
        assert False
    except SystemExit:
        pass
    else:
        raise Exception
Esempio n. 2
0
def test_help():
    try:
        main.main([prog, '--help'])
        assert False
    except SystemExit:
        pass
    else:
        raise Exception
Esempio n. 3
0
def test_mutually_exclusive():
    try:
        main.main([
            prog, '--pipeline', 'quality_control', '--info', "quality_control"
        ])
        assert False
    except SystemExit:
        assert True
Esempio n. 4
0
def _test_with_cluster_config(tmpdir):
    directory = tmpdir.mkdir("analysis2")
    name = directory.__str__()
    file1 = sequana_data('Hm2_GTGAAA_L005_R1_001.fastq.gz', 'data')
    main.main([prog, "--pipeline", "rnaseq", "--file1", file1, "--snakemake-cluster", 
        '"sbatch --mem={cluster.ram}"',"--force",
        "--working-directory", name])
    with open("%s/runme.sh" %  name) as fh: 
        assert "cluster_config" in fh.read()
Esempio n. 5
0
def _test_with_cluster_config(tmpdir):
    directory = tmpdir.mkdir("analysis2")
    name = directory.__str__()
    file1 = sequana_data('Hm2_GTGAAA_L005_R1_001.fastq.gz', 'data')
    main.main([
        prog, "--pipeline", "rnaseq", "--file1", file1, "--snakemake-cluster",
        '"sbatch --mem={cluster.ram}"', "--force", "--working-directory", name
    ])
    with open("%s/runme.sh" % name) as fh:
        assert "cluster_config" in fh.read()
Esempio n. 6
0
def test_config_params(tmpdir):
    directory = tmpdir.mkdir("analysis3")
    name = directory.__str__()
    file1 = sequana_data('Hm2_GTGAAA_L005_R1_001.fastq.gz', 'data')
    main.main([prog, "--pipeline", "quality_control", "--force",  "--file1", file1,
        "--no-adapters",  "--config-params",  "bwa_mem_phix:threads:4" ,
        "--working-directory", name])

    try:
        main.main([prog, "--pipeline", "quality_control", "--force",  "--file1", file1,
            "--no-adapters",  "--config-params",  "bwa_mem_phix",
            "--working-directory", name])
        assert False
    except:
        assert True
Esempio n. 7
0
def test_input(tmpdir):
    directory = tmpdir.mkdir("analysis0")
    name = directory.__str__()

    file1 = sequana_data('Hm2_GTGAAA_L005_R1_001.fastq.gz', 'data')
    file2 = sequana_data('Hm2_GTGAAA_L005_R2_001.fastq.gz', 'data')
    main.main([
        prog, "--pipeline", "quality_control", "--file1", file1, "--file2",
        file2, "--no-adapters", "--force", "--working-directory", name
    ])

    try:
        main.main([
            prog, "--pipeline", "quality_control", "--file1", file1 + "dummy",
            "--no-adapters", "--force", "--working-directory", name
        ])
        assert False
    except ValueError:
        assert True
    try:
        main.main([
            prog, "--pipeline", "quality_control", "--file1", file1,
            "--no-adapters", "--force", "--file2", file2 + "duly",
            "--working-directory", name
        ])
        assert False
    except ValueError:
        assert True
    try:
        main.main([
            prog, "--pipeline", "quality_control", "--file1", file1,
            "--no-adapters", "--force", "--file2", file2,
            "--working-directory", name, "--kraken", "dummy"
        ])
        assert False
    except ValueError:
        assert True
    try:
        main.main([
            prog, "--pipeline", "quality_control", "--file1", file1,
            "--no-adapters", "--force", "--file2", file2,
            "--working-directory", name, "--kraken", "dummy"
        ])
        assert False
    except ValueError:
        assert True
Esempio n. 8
0
def test_config_params(tmpdir):
    directory = tmpdir.mkdir("analysis3")
    name = directory.__str__()
    file1 = sequana_data('Hm2_GTGAAA_L005_R1_001.fastq.gz', 'data')
    main.main([
        prog, "--pipeline", "quality_control", "--force", "--file1", file1,
        "--no-adapters", "--config-params", "bwa_mem_phix:threads:4",
        "--working-directory", name
    ])

    try:
        main.main([
            prog, "--pipeline", "quality_control", "--force", "--file1", file1,
            "--no-adapters", "--config-params", "bwa_mem_phix",
            "--working-directory", name
        ])
        assert False
    except:
        assert True
Esempio n. 9
0
def test_input(tmpdir):
    directory = tmpdir.mkdir("analysis0")
    name = directory.__str__()

    file1 = sequana_data('Hm2_GTGAAA_L005_R1_001.fastq.gz', 'data')
    file2 = sequana_data('Hm2_GTGAAA_L005_R2_001.fastq.gz', 'data')
    main.main([prog, "--pipeline", "quality_control", "--file1", 
              file1, "--file2", file2, "--no-adapters" , "--force",
              "--working-directory", name])

    try:
        main.main([prog, "--pipeline", "quality_control", "--file1", 
              file1+"dummy", "--no-adapters" , "--force",
              "--working-directory", name])
        assert False
    except ValueError:
        assert True
    try:
        main.main([prog, "--pipeline", "quality_control", "--file1", 
              file1, "--no-adapters" , "--force", "--file2",
              file2+"duly","--working-directory", name])
        assert False
    except ValueError:
        assert True
    try:
        main.main([prog, "--pipeline", "quality_control", "--file1", 
              file1, "--no-adapters" , "--force", "--file2",
              file2,"--working-directory", name, "--kraken", "dummy"])
        assert False
    except ValueError:
        assert True
    try:
        main.main([prog, "--pipeline", "quality_control", "--file1", 
              file1, "--no-adapters" , "--force", "--file2",
              file2,"--working-directory", name, "--kraken", "dummy"])
        assert False
    except ValueError:
        assert True
Esempio n. 10
0
def test_init(mocker):
    try:
        # py3
        with mocker.patch('builtins.input', return_value="y"):
            try:
                main.main([prog, '--pipeline', "qualitydummy"])
                assert False
            except:
                assert True
    except:
        # py2
        with mocker.patch('__builtin__.input', return_value="y"):
            main.main([prog, '--pipeline', "quality_control"])
        with mocker.patch('__builtin__.input', return_value="y"):
            try:
                main.main([prog, '--pipeline', "qualitydummy"])
                assert False
            except:
                assert True
Esempio n. 11
0
def test_init(mocker):
    try:
        # py3
        with mocker.patch('builtins.input', return_value="y"):
            try:
                main.main([prog, '--pipeline', "qualitydummy"])
                assert False
            except:
                assert True
    except:
        # py2
        with mocker.patch('__builtin__.input', return_value="y"):
            main.main([prog, '--pipeline', "quality_control"])
        with mocker.patch('__builtin__.input', return_value="y"):
            try:
                main.main([prog, '--pipeline', "qualitydummy"])
                assert False
            except:
                assert True
Esempio n. 12
0
def test_main():
    main.main([prog])
Esempio n. 13
0
def test_show_pipelines():
    main.main([prog, '--show-pipelines'])
Esempio n. 14
0
def _test_issue(mocker):
    def func(*args, **kwargs):
        pass

    with patch('easydev.onweb', func):
        main.main([prog, '--issue'])
Esempio n. 15
0
def test_info(mocker):
    def func(*args, **kwargs):
        pass

    with patch('easydev.onweb', func):
        main.main([prog, '--info', "quality_control"])
Esempio n. 16
0
def test_get_config():

    main.main([prog,  "--pipeline", "quality_control",
        "--get-config"])
    import os
    os.remove("config.yaml")
Esempio n. 17
0
def test_info(mocker):
    def func(*args, **kwargs):
        pass
    with patch('easydev.onweb', func ):
        main.main([prog, '--info', "quality_control"])
Esempio n. 18
0
def test_get_config():

    main.main([prog, "--pipeline", "quality_control", "--get-config"])
    import os
    os.remove("config.yaml")
Esempio n. 19
0
def _test_issue(mocker):
    def func(*args, **kwargs):
        pass
    with patch('easydev.onweb', func ):
        main.main([prog, '--issue'])
Esempio n. 20
0
def test_version():
    main.main([prog, '--version'])
Esempio n. 21
0
def test_show_pipelines():
    main.main([prog, '--show-pipelines'])
Esempio n. 22
0
def test_mutually_exclusive():
    try:
        main.main([prog, '--pipeline', 'quality_control', '--info', "quality_control"])
        assert False
    except SystemExit:
        assert True
Esempio n. 23
0
def test_main():
    main.main([prog])
Esempio n. 24
0
def test_version():
    main.main([prog, '--version'])