示例#1
0
 def test_R_supported_version(self):
     """R is in path and version is supported """
     minimum_version = (2, 12, 0)
     self.assertTrue(which('R'),
                     "R not found. This may or may not be a problem depending on " +
                     "which components of QIIME you plan to use.")
     command = "R --version | grep 'R version' | awk '{print $3}'"
     proc = Popen(command, shell=True, universal_newlines=True,
                  stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = False
         if version[0] == minimum_version[0]:
             if version[1] == minimum_version[1]:
                 if version[2] >= minimum_version[2]:
                     pass_test = True
             elif version[1] > minimum_version[1]:
                 pass_test = True
         elif version[0] > minimum_version[0]:
             pass_test = True
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,
                     "Unsupported R version. %s or greater is required, but running %s."
                     % ('.'.join(map(str, minimum_version)), version_string))
示例#2
0
文件: cmd.py 项目: bsc-wdc/compss
def remote_submit_job(login_info: str,
                      remote_dir: str,
                      app_args: str,
                      modules,
                      envars=None) -> None:
    """ Execute the given command in the remote COMPSs environment.

    :param cmd: Command to execute.
    :returns: The execution stdout.
    """

    enqueue_debug = '-d' if utils.is_debug() else ''

    commands = [
        f'cd {remote_dir}', *modules,
        f'enqueue_compss {enqueue_debug} {app_args}'
    ]

    if envars:
        commands = [f'export {var}' for var in envars] + commands

    if utils.is_debug():
        print('********* DEBUG *********')
        print('Remote submit job commands:')
        for cmd in commands:
            print('\t', '->', cmd)
        print('***************************')

    stdout = utils.ssh_run_commands(login_info, commands)
    job_id = stdout.strip().split('\n')[-1].split(' ')[-1]
    print('Job submitted:', job_id)
    return job_id
示例#3
0
    def test_ParsInsert_supported_version(self):
        """ParsInsert is in path and version is supported """
        acceptable_version = ["1.04"]
        self.assertTrue(
            which('ParsInsert'),
            "ParsInsert not found. This may or may not be a problem depending on "
            + "which components of QIIME you plan to use.")
        command = "ParsInsert -v | grep App | awk '{print $3}'"
        proc = Popen(command,
                     shell=True,
                     universal_newlines=True,
                     stdout=PIPE,
                     stderr=STDOUT)
        stdout = proc.stdout.read()

        # remove log file generated
        remove_files(['ParsInsert.log'], error_on_missing=False)

        version_string = stdout.strip()
        try:
            pass_test = version_string in acceptable_version
        except ValueError:
            pass_test = False
            version_string = stdout
        self.assertTrue(
            pass_test,
            "Unsupported ParsInsert version. %s is required, but running %s." %
            ('.'.join(map(str, acceptable_version)), version_string))
示例#4
0
 def test_clearcut_supported_version(self):
     """clearcut is in path and version is supported """
     acceptable_version = (1, 0, 9)
     self.assertTrue(
         which('clearcut'),
         "clearcut not found. This may or may not be a problem depending on "
         + "which components of QIIME you plan to use.")
     command = "clearcut -V"
     proc = Popen(command,
                  shell=True,
                  universal_newlines=True,
                  stdout=PIPE,
                  stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[2].strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(
         pass_test,
         "Unsupported clearcut version. %s is required, but running %s." %
         ('.'.join(map(str, acceptable_version)), version_string))
示例#5
0
 def test_raxmlHPC_supported_version(self):
     """raxmlHPC is in path and version is supported """
     acceptable_version = [(7, 3, 0), (7, 3, 0)]
     self.assertTrue(
         which('raxmlHPC'),
         "raxmlHPC not found. This may or may not be a problem depending on "
         + "which components of QIIME you plan to use.")
     command = "raxmlHPC -v | grep version"
     proc = Popen(command,
                  shell=True,
                  universal_newlines=True,
                  stdout=PIPE,
                  stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[4].strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version in acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(
         pass_test,
         "Unsupported raxmlHPC version. %s is required, but running %s." %
         ('.'.join(map(str, acceptable_version)), version_string))
示例#6
0
    def test_mothur_supported_version(self):
        """mothur is in path and version is supported """
        acceptable_version = (1, 25, 0)
        self.assertTrue(
            which("mothur"),
            "mothur not found. This may or may not be a problem depending on "
            + "which components of QIIME you plan to use.",
        )
        # mothur creates a log file in cwd, so create a tmp and cd there first
        log_file = join(get_qiime_temp_dir(), "mothur.log")
        command = "mothur \"#set.logfile(name=%s)\" | grep '^mothur v'" % log_file
        stdout, stderr, exit_Status = qiime_system_call(command)

        # remove log file
        remove_files([log_file], error_on_missing=False)

        version_string = stdout.strip().split(" ")[1].strip("v.")
        try:
            version = tuple(map(int, version_string.split(".")))
            pass_test = version == acceptable_version
        except ValueError:
            pass_test = False
            version_string = stdout
        self.assertTrue(
            pass_test,
            "Unsupported mothur version. %s is required, but running %s."
            % (".".join(map(str, acceptable_version)), version_string),
        )
示例#7
0
    def test_ParsInsert_supported_version(self):
        """ParsInsert is in path and version is supported """
        acceptable_version = ["1.04"]
        self.assertTrue(
            which("ParsInsert"),
            "ParsInsert not found. This may or may not be a problem depending on "
            + "which components of QIIME you plan to use.",
        )
        command = "ParsInsert -v | grep App | awk '{print $3}'"
        proc = Popen(command, shell=True, universal_newlines=True, stdout=PIPE, stderr=STDOUT)
        stdout = proc.stdout.read()

        # remove log file generated
        remove_files(["ParsInsert.log"], error_on_missing=False)

        version_string = stdout.strip()
        try:
            pass_test = version_string in acceptable_version
        except ValueError:
            pass_test = False
            version_string = stdout
        self.assertTrue(
            pass_test,
            "Unsupported ParsInsert version. %s is required, but running %s."
            % (".".join(map(str, acceptable_version)), version_string),
        )
示例#8
0
 def test_rtax_supported_version(self):
     """rtax is in path and version is supported """
     acceptable_version = [(0, 984)]
     self.assertTrue(
         which('rtax'),
         "rtax not found. This may or may not be a problem depending on " +
         "which components of QIIME you plan to use.")
     command = "rtax 2>&1 > %s | grep Version | awk '{print $2}'" % devnull
     proc = Popen(command,
                  shell=True,
                  universal_newlines=True,
                  stdout=PIPE,
                  stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version in acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(
         pass_test,
         "Unsupported rtax version. %s is required, but running %s." %
         ('.'.join(map(str, acceptable_version)), version_string))
示例#9
0
 def test_R_supported_version(self):
     """R is in path and version is supported """
     minimum_version = (2, 12, 0)
     self.assertTrue(
         which('R'),
         "R not found. This may or may not be a problem depending on " +
         "which components of QIIME you plan to use.")
     command = "R --version | grep 'R version' | awk '{print $3}'"
     proc = Popen(command,
                  shell=True,
                  universal_newlines=True,
                  stdout=PIPE,
                  stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = False
         if version[0] == minimum_version[0]:
             if version[1] == minimum_version[1]:
                 if version[2] >= minimum_version[2]:
                     pass_test = True
             elif version[1] > minimum_version[1]:
                 pass_test = True
         elif version[0] > minimum_version[0]:
             pass_test = True
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(
         pass_test,
         "Unsupported R version. %s or greater is required, but running %s."
         % ('.'.join(map(str, minimum_version)), version_string))
示例#10
0
    def test_python_supported_version(self):
        """python is in path and version is supported """
        min_acceptable_version = (2, 7, 0)
        min_unacceptable_version = (3, 0, 0)

        command = 'python --version'
        proc = Popen(command, shell=True, universal_newlines=True,
                     stdout=PIPE, stderr=STDOUT)
        stdout = proc.stdout.read()

        version_str_matches = re.findall('Python\s+(\S+)\s*', stdout.strip())
        self.assertEqual(len(version_str_matches), 1,
                         "Could not determine the Python version in '%s'." %
                         stdout)
        version_string = version_str_matches[0]

        try:
            if version_string[-1] == '+':
                version_string = version_string[:-1]
            version = tuple(map(int, version_string.split('.')))
            if len(version) == 2:
                version = (version[0], version[1], 0)
            pass_test = (version >= min_acceptable_version and
                         version < min_unacceptable_version)
        except ValueError:
            pass_test = False
            version_string = stdout
        self.assertTrue(pass_test,
                        "Unsupported Python version. Must be >= %s and < %s, "
                        "but running %s."
                        % ('.'.join(map(str, min_acceptable_version)),
                           '.'.join(map(str, min_unacceptable_version)),
                           version_string))
示例#11
0
    def test_python_supported_version(self):
        """python is in path and version is supported """
        min_acceptable_version = (2, 7, 0)
        min_unacceptable_version = (3, 0, 0)

        command = 'python --version'
        proc = Popen(command,
                     shell=True,
                     universal_newlines=True,
                     stdout=PIPE,
                     stderr=STDOUT)
        stdout = proc.stdout.read()

        version_str_matches = re.findall('Python\s+(\S+)\s*', stdout.strip())
        self.assertEqual(
            len(version_str_matches), 1,
            "Could not determine the Python version in '%s'." % stdout)
        version_string = version_str_matches[0]

        try:
            if version_string[-1] == '+':
                version_string = version_string[:-1]
            version = tuple(map(int, version_string.split('.')))
            if len(version) == 2:
                version = (version[0], version[1], 0)
            pass_test = (version >= min_acceptable_version
                         and version < min_unacceptable_version)
        except ValueError:
            pass_test = False
            version_string = stdout
        self.assertTrue(
            pass_test, "Unsupported Python version. Must be >= %s and < %s, "
            "but running %s." %
            ('.'.join(map(str, min_acceptable_version)), '.'.join(
                map(str, min_unacceptable_version)), version_string))
示例#12
0
    def test_mothur_supported_version(self):
        """mothur is in path and version is supported """
        acceptable_version = (1, 25, 0)
        self.assertTrue(
            which('mothur'),
            "mothur not found. This may or may not be a problem depending on "
            + "which components of QIIME you plan to use.")
        # mothur creates a log file in cwd, so create a tmp and cd there first
        log_file = join(get_qiime_temp_dir(), 'mothur.log')
        command = "mothur \"#set.logfile(name=%s)\" | grep '^mothur v'" % log_file
        stdout, stderr, exit_Status = qiime_system_call(command)

        # remove log file
        remove_files([log_file], error_on_missing=False)

        version_string = stdout.strip().split(' ')[1].strip('v.')
        try:
            version = tuple(map(int, version_string.split('.')))
            pass_test = version == acceptable_version
        except ValueError:
            pass_test = False
            version_string = stdout
        self.assertTrue(
            pass_test,
            "Unsupported mothur version. %s is required, but running %s." %
            ('.'.join(map(str, acceptable_version)), version_string))
 def testClose(self):
     sequentialStorage = SequentialStorage(self.tempdir)
     sequentialStorage.add(identifier='abc', data="1")
     lockFile = join(self.tempdir, 'write.lock')
     self.assertTrue(isfile(lockFile))
     sequentialStorage.close()
     stdout, stderr = Popen("lsof -n %s" % lockFile, stdout=PIPE, stderr=PIPE, shell=True).communicate()
     self.assertEquals('', stdout.strip())
     self.assertRaises(AttributeError, lambda: sequentialStorage.add('def', data='2'))
示例#14
0
def run_subprocess(command, *args, **kwargs):
    """Run command using subprocess.Popen

    Run command and wait for command to complete. If the return code was zero
    then return, otherwise raise CalledProcessError.
    By default, this will also add stdout= and stderr=subproces.PIPE
    to the call to Popen to suppress printing to the terminal.

    Parameters
    ----------
    command : list of str
        Command to run as subprocess (see subprocess.Popen documentation).
    *args, **kwargs : arguments
        Arguments to pass to subprocess.Popen.

    Returns
    -------
    stdout : str
        Stdout returned by the process.
    stderr : str
        Stderr returned by the process.
    """
    if 'stderr' not in kwargs:
        kwargs['stderr'] = subprocess.PIPE
    if 'stdout' not in kwargs:
        kwargs['stdout'] = subprocess.PIPE

    # Check the PATH environment variable. If run_subprocess() is to be called
    # frequently this should be refactored so as to only check the path once.
    env = kwargs.get('env', os.environ)
    if any(p.startswith('~') for p in env['PATH'].split(os.pathsep)):
        msg = ("Your PATH environment variable contains at least one path "
               "starting with a tilde ('~') character. Such paths are not "
               "interpreted correctly from within Python. It is recommended "
               "that you use '$HOME' instead of '~'.")
        warnings.warn(msg)

    logger.info("Running subprocess: %s" % str(command))
    p = subprocess.Popen(command, *args, **kwargs)
    stdout, stderr = p.communicate()

    if stdout.strip():
        logger.info("stdout:\n%s" % stdout)
    if stderr.strip():
        logger.info("stderr:\n%s" % stderr)

    output = (stdout, stderr)
    if p.returncode:
        print output
        raise subprocess.CalledProcessError(p.returncode, command, output)

    return output
示例#15
0
def run_subprocess(command, *args, **kwargs):
    """Run command using subprocess.Popen

    Run command and wait for command to complete. If the return code was zero
    then return, otherwise raise CalledProcessError.
    By default, this will also add stdout= and stderr=subproces.PIPE
    to the call to Popen to suppress printing to the terminal.

    Parameters
    ----------
    command : list of str
        Command to run as subprocess (see subprocess.Popen documentation).
    *args, **kwargs : arguments
        Arguments to pass to subprocess.Popen.

    Returns
    -------
    stdout : str
        Stdout returned by the process.
    stderr : str
        Stderr returned by the process.
    """
    if 'stderr' not in kwargs:
        kwargs['stderr'] = subprocess.PIPE
    if 'stdout' not in kwargs:
        kwargs['stdout'] = subprocess.PIPE

    # Check the PATH environment variable. If run_subprocess() is to be called
    # frequently this should be refactored so as to only check the path once.
    env = kwargs.get('env', os.environ)
    if any(p.startswith('~') for p in env['PATH'].split(os.pathsep)):
        msg = ("Your PATH environment variable contains at least one path "
               "starting with a tilde ('~') character. Such paths are not "
               "interpreted correctly from within Python. It is recommended "
               "that you use '$HOME' instead of '~'.")
        warnings.warn(msg)

    logger.info("Running subprocess: %s" % str(command))
    p = subprocess.Popen(command, *args, **kwargs)
    stdout, stderr = p.communicate()

    if stdout.strip():
        logger.info("stdout:\n%s" % stdout)
    if stderr.strip():
        logger.info("stderr:\n%s" % stderr)

    output = (stdout, stderr)
    if p.returncode:
        print output
        raise subprocess.CalledProcessError(p.returncode, command, output)

    return output
示例#16
0
 def test_rtax_supported_version(self):
     """rtax is in path and version is supported """
     acceptable_version = [(0, 984)]
     self.assertTrue(which('rtax'),
                     "rtax not found. This may or may not be a problem depending on " +
                     "which components of QIIME you plan to use.")
     command = "rtax 2>&1 > %s | grep Version | awk '{print $2}'" % devnull
     proc = Popen(command, shell=True, universal_newlines=True,
                  stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version in acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,
                     "Unsupported rtax version. %s is required, but running %s."
                     % ('.'.join(map(str, acceptable_version)), version_string))
示例#17
0
 def test_clearcut_supported_version(self):
     """clearcut is in path and version is supported """
     acceptable_version = (1, 0, 9)
     self.assertTrue(which('clearcut'),
                     "clearcut not found. This may or may not be a problem depending on " +
                     "which components of QIIME you plan to use.")
     command = "clearcut -V"
     proc = Popen(command, shell=True, universal_newlines=True,
                  stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[2].strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,
                     "Unsupported clearcut version. %s is required, but running %s."
                     % ('.'.join(map(str, acceptable_version)), version_string))
示例#18
0
 def test_raxmlHPC_supported_version(self):
     """raxmlHPC is in path and version is supported """
     acceptable_version = [(7, 3, 0), (7, 3, 0)]
     self.assertTrue(which('raxmlHPC'),
                     "raxmlHPC not found. This may or may not be a problem depending on " +
                     "which components of QIIME you plan to use.")
     command = "raxmlHPC -v | grep version"
     proc = Popen(command, shell=True, universal_newlines=True,
                  stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[4].strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version in acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,
                     "Unsupported raxmlHPC version. %s is required, but running %s."
                     % ('.'.join(map(str, acceptable_version)), version_string))
示例#19
0
 def test_INFERNAL_supported_version(self):
     """INFERNAL is in path and version is supported """
     acceptable_version = (1, 0, 2)
     self.assertTrue(app_path('cmbuild'),
      "Infernal not found. This may or may not be a problem depending on "+\
      "which components of QIIME you plan to use.")
     command = "cmbuild -h | grep INF"
     proc = Popen(command,shell=True,universal_newlines=True,\
                      stdout=PIPE,stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[2].strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,\
      "Unsupported INFERNAL version. %s is required, but running %s." \
      % ('.'.join(map(str,acceptable_version)), version_string))
示例#20
0
 def test_pplacer_supported_version(self):
     """pplacer is in path and version is supported """
     acceptable_version = [(1, 1), (1, 1)]
     self.assertTrue(app_path('pplacer'),
                     "pplacer not found. This may or may not be a problem depending on " +
                     "which components of QIIME you plan to use.")
     command = "pplacer --version"
     proc = Popen(command, shell=True, universal_newlines=True,
                  stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip()[1:4]
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version in acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,
                     "Unsupported pplacer version. %s is required, but running %s."
                     % ('.'.join(map(str, acceptable_version)), version_string))
示例#21
0
 def test_FastTree_supported_version(self):
     """FastTree is in path and version is supported """
     acceptable_version = (2, 1, 3)
     self.assertTrue(app_path('FastTree'),
                     "FastTree not found. This may or may not be a problem depending on " +
                     "which components of QIIME you plan to use.")
     command = "FastTree 2>&1 > %s | grep version" % devnull
     proc = Popen(command, shell=True, universal_newlines=True,
                  stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[4].strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,
                     "Unsupported FastTree version. %s is required, but running %s."
                     % ('.'.join(map(str, acceptable_version)), version_string))
示例#22
0
 def test_pplacer_supported_version(self):
     """pplacer is in path and version is supported """
     acceptable_version = [(1, 1), (1, 1)]
     self.assertTrue(app_path('pplacer'),
      "pplacer not found. This may or may not be a problem depending on "+\
      "which components of QIIME you plan to use.")
     command = "pplacer --version"
     proc = Popen(command,shell=True,universal_newlines=True,\
                      stdout=PIPE,stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip()[1:4]
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version in acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,\
      "Unsupported pplacer version. %s is required, but running %s." \
      % ('.'.join(map(str,acceptable_version)), version_string))
示例#23
0
 def test_INFERNAL_supported_version(self):
     """INFERNAL is in path and version is supported """
     acceptable_version = (1,0,2)
     self.assertTrue(app_path('cmbuild'),
      "Infernal not found. This may or may not be a problem depending on "+\
      "which components of QIIME you plan to use.")
     command = "cmbuild -h | grep INF"
     proc = Popen(command,shell=True,universal_newlines=True,\
                      stdout=PIPE,stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[2].strip()
     try:
         version = tuple(map(int,version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,\
      "Unsupported INFERNAL version. %s is required, but running %s." \
      % ('.'.join(map(str,acceptable_version)), version_string))
示例#24
0
 def test_muscle_supported_version(self):
     """muscle is in path and version is supported """
     acceptable_version = (3,8,31)
     self.assertTrue(app_path('muscle'),
      "muscle not found. This may or may not be a problem depending on "+\
      "which components of QIIME you plan to use.")
     command = "muscle -version"
     proc = Popen(command,shell=True,universal_newlines=True,\
                      stdout=PIPE,stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[1].strip('v')
     try:
         version = tuple(map(int,version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,\
      "Unsupported muscle version. %s is required, but running %s." \
      % ('.'.join(map(str,acceptable_version)), version_string))
示例#25
0
 def test_FastTree_supported_version(self):
     """FastTree is in path and version is supported """
     acceptable_version = (2, 1, 3)
     self.assertTrue(app_path('FastTree'),
      "FastTree not found. This may or may not be a problem depending on "+\
      "which components of QIIME you plan to use.")
     command = "FastTree 2>&1 > %s | grep version" % devnull
     proc = Popen(command,shell=True,universal_newlines=True,\
                      stdout=PIPE,stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(' ')[4].strip()
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,\
      "Unsupported FastTree version. %s is required, but running %s." \
      % ('.'.join(map(str,acceptable_version)), version_string))
示例#26
0
 def test_uclust_supported_version(self):
     """uclust is in path and version is supported """
     acceptable_version = (1, 2, 22)
     self.assertTrue(app_path('uclust'),
      "uclust not found. This may or may not be a problem depending on "+\
      "which components of QIIME you plan to use.")
     command = 'uclust --version'
     proc = Popen(command,shell=True,universal_newlines=True,\
                      stdout=PIPE,stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split('v')[-1].strip('q')
     try:
         version = tuple(map(int, version_string.split('.')))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,\
      "Unsupported uclust version. %s is required, but running %s." \
      % ('.'.join(map(str,acceptable_version)), version_string))
示例#27
0
 def test_python_supported_version(self):
     """python is in path and version is supported """
     acceptable_version = (2, 7, 3)
     command = 'python --version'
     proc = Popen(command,shell=True,universal_newlines=True, \
                      stdout=PIPE,stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split('Python')[-1].strip()
     try:
         if version_string[-1] == '+':
             version_string = version_string[:-1]
         version = tuple(map(int, version_string.split('.')))
         if len(version) == 2:
             version = (version[0], version[1], 0)
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,\
      "Unsupported python version. %s is required, but running %s." \
      % ('.'.join(map(str,acceptable_version)), version_string))
示例#28
0
 def test_python_supported_version(self):
     """python is in path and version is supported """
     acceptable_version = (2, 7, 3)
     command = 'python --version'
     proc = Popen(command, shell=True, universal_newlines=True,
                  stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split('Python')[-1].strip()
     try:
         if version_string[-1] == '+':
             version_string = version_string[:-1]
         version = tuple(map(int, version_string.split('.')))
         if len(version) == 2:
             version = (version[0], version[1], 0)
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(pass_test,
                     "Unsupported python version. %s is required, but running %s."
                     % ('.'.join(map(str, acceptable_version)), version_string))
示例#29
0
 def test_blast_supported_version(self):
     """blast is in path and version is supported """
     acceptable_version = (2, 2, 22)
     self.assertTrue(
         which("blastall"),
         "blast not found. This may or may not be a problem depending on "
         + "which components of QIIME you plan to use.",
     )
     command = "blastall | grep blastall"
     proc = Popen(command, shell=True, universal_newlines=True, stdout=PIPE, stderr=STDOUT)
     stdout = proc.stdout.read()
     version_string = stdout.strip().split(" ")[1].strip()
     try:
         version = tuple(map(int, version_string.split(".")))
         pass_test = version == acceptable_version
     except ValueError:
         pass_test = False
         version_string = stdout
     self.assertTrue(
         pass_test,
         "Unsupported blast version. %s is required, but running %s."
         % (".".join(map(str, acceptable_version)), version_string),
     )