示例#1
0
def get_module_tests (module_name, valgrind=False) :
  dist_path = libtbx.env.dist_path(module_name)
  if (dist_path is None) :
    raise Sorry("'%s' is not a valid CCTBX module." % module_name)
  # XXX don't check for file name, because import conventions differ among
  # derived modules - dist_path can be either the sys.path entry or the actual
  # module contents.  If the file is missing the import below will fail, which
  # is okay for testing purposes.
  tst_list = import_python_object(
    import_path="%s.run_tests.tst_list" % module_name,
    error_prefix="",
    target_must_be="",
    where_str="").object
  assert (isinstance(tst_list, tuple) or isinstance(tst_list, list))
  build_path = libtbx.env.under_build(module_name)
  assert (build_path is not None) and (dist_path is not None)
  commands = []
  co = group_args(
    verbose=False,
    quick=True,
    valgrind=valgrind)
  for cmd in test_utils.iter_tests_cmd(
      co=co,
      build_dir=build_path,
      dist_dir=dist_path,
      tst_list=tst_list) :
    commands.append(cmd)
  return commands
示例#2
0
文件: parallel.py 项目: hickerson/bbn
def get_module_tests (module_name, valgrind=False) :
  dist_path = libtbx.env.dist_path(module_name)
  if (dist_path is None) :
    raise Sorry("'%s' is not a valid CCTBX module." % module_name)
  elif (not os.path.isfile(os.path.join(dist_path, "run_tests.py"))) :
    raise Sorry("%s/run_tests.py does not exist." % module_name)
  tst_list = import_python_object(
    import_path="%s.run_tests.tst_list" % module_name,
    error_prefix="",
    target_must_be="",
    where_str="").object
  assert (isinstance(tst_list, tuple) or isinstance(tst_list, list))
  build_path = libtbx.env.under_build(module_name)
  assert (build_path is not None) and (dist_path is not None)
  commands = []
  co = group_args(
    verbose=False,
    quick=True,
    valgrind=valgrind)
  for cmd in test_utils.iter_tests_cmd(
      co=co,
      build_dir=build_path,
      dist_dir=dist_path,
      tst_list=tst_list) :
    commands.append(cmd)
  return commands
示例#3
0
def get_test_list(module_name,
                  test_type='tst_list',
                  valgrind=False,
                  python_keyword_text=None):
    dist_path = libtbx.env.dist_path(module_name)
    if dist_path is None:
        raise Sorry("'%s' is not a valid CCTBX module." % module_name)
    # XXX don't check for file name, because import conventions differ among
    # derived modules - dist_path can be either the sys.path entry or the actual
    # module contents.  If the file is missing the import below will fail, which
    # is okay for testing purposes.
    try:
        tst_list = list(
            import_python_object(import_path="%s.run_tests.%s" %
                                 (module_name, test_type),
                                 error_prefix="",
                                 target_must_be="",
                                 where_str="").object)
    except AttributeError:
        tst_list = list()
    build_path = libtbx.env.under_build(module_name)
    assert (build_path is not None) and (dist_path is not None)
    commands = []
    co = group_args(verbose=False,
                    quick=True,
                    valgrind=valgrind,
                    python_keyword_text=python_keyword_text)
    for cmd in test_utils.iter_tests_cmd(co=co,
                                         build_dir=build_path,
                                         dist_dir=dist_path,
                                         tst_list=tst_list):
        commands.append(cmd)
    return commands
示例#4
0
def get_module_tests(module_name, valgrind=False, slow_tests=False):
    dist_path = libtbx.env.dist_path(module_name)
    if dist_path is None:
        raise Sorry("'%s' is not a valid CCTBX module." % module_name)
    # XXX don't check for file name, because import conventions differ among
    # derived modules - dist_path can be either the sys.path entry or the actual
    # module contents.  If the file is missing the import below will fail, which
    # is okay for testing purposes.
    tst_list = import_python_object(import_path="%s.run_tests.tst_list" %
                                    module_name,
                                    error_prefix="",
                                    target_must_be="",
                                    where_str="").object
    assert (isinstance(tst_list, tuple) or isinstance(tst_list, list))
    if slow_tests:
        try:
            tst_list_slow = import_python_object(
                import_path="%s.run_tests.tst_list_slow" % module_name,
                error_prefix="",
                target_must_be="",
                where_str="").object
        except AttributeError:
            pass
        else:
            assert (isinstance(tst_list_slow, tuple)
                    or isinstance(tst_list_slow, list))
            if isinstance(tst_list, tuple):
                tst_list = list(tst_list)
                tst.list.extend(tst_list_slow)
                tst_list = tuple(tst_list)
            else:
                tst_list.extend(tst_list_slow)
    build_path = libtbx.env.under_build(module_name)
    assert (build_path is not None) and (dist_path is not None)
    commands = []
    co = group_args(verbose=False, quick=True, valgrind=valgrind)
    for cmd in test_utils.iter_tests_cmd(co=co,
                                         build_dir=build_path,
                                         dist_dir=dist_path,
                                         tst_list=tst_list):
        commands.append(cmd)
    return commands
示例#5
0
def get_module_tests(module_name, valgrind=False):
    dist_path = libtbx.env.dist_path(module_name)
    if (dist_path is None):
        raise Sorry("'%s' is not a valid CCTBX module." % module_name)
    elif (not os.path.isfile(os.path.join(dist_path, "run_tests.py"))):
        raise Sorry("%s/run_tests.py does not exist." % module_name)
    tst_list = import_python_object(import_path="%s.run_tests.tst_list" %
                                    module_name,
                                    error_prefix="",
                                    target_must_be="",
                                    where_str="").object
    assert (isinstance(tst_list, tuple) or isinstance(tst_list, list))
    build_path = libtbx.env.under_build(module_name)
    assert (build_path is not None) and (dist_path is not None)
    commands = []
    co = group_args(verbose=False, quick=True, valgrind=valgrind)
    for cmd in test_utils.iter_tests_cmd(co=co,
                                         build_dir=build_path,
                                         dist_dir=dist_path,
                                         tst_list=tst_list):
        commands.append(cmd)
    return commands