当前位置: 首页>>代码示例>>Python>>正文


Python Factory.loadPlugins方法代码示例

本文整理汇总了Python中Factory.Factory.loadPlugins方法的典型用法代码示例。如果您正苦于以下问题:Python Factory.loadPlugins方法的具体用法?Python Factory.loadPlugins怎么用?Python Factory.loadPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Factory.Factory的用法示例。


在下文中一共展示了Factory.loadPlugins方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: buildAndRun

# 需要导入模块: from Factory import Factory [as 别名]
# 或者: from Factory.Factory import loadPlugins [as 别名]
class TestHarness:

  @staticmethod
  def buildAndRun(argv, app_name, moose_dir):
    if '--store-timing' in argv:
      harness = TestTimer(argv, app_name, moose_dir)
    else:
      harness = TestHarness(argv, app_name, moose_dir)

    harness.findAndRunTests()

  def __init__(self, argv, app_name, moose_dir):
    self.factory = Factory()

    # Get dependant applications and load dynamic tester plugins
    # If applications have new testers, we expect to find them in <app_dir>/scripts/TestHarness/testers
    dirs = [os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))]
    sys.path.append(os.path.join(moose_dir, 'framework', 'scripts'))   # For find_dep_apps.py

    # Use the find_dep_apps script to get the dependant applications for an app
    import find_dep_apps
    depend_app_dirs = find_dep_apps.findDepApps(app_name)
    dirs.extend([os.path.join(my_dir, 'scripts', 'TestHarness') for my_dir in depend_app_dirs.split('\n')])

    # Finally load the plugins!
    self.factory.loadPlugins(dirs, 'testers', Tester)

    self.test_table = []
    self.num_passed = 0
    self.num_failed = 0
    self.num_skipped = 0
    self.num_pending = 0
    self.host_name = gethostname()
    self.moose_dir = moose_dir
    self.run_tests_dir = os.path.abspath('.')
    self.code = '2d2d6769726c2d6d6f6465'
    # Assume libmesh is a peer directory to MOOSE if not defined
    if os.environ.has_key("LIBMESH_DIR"):
      self.libmesh_dir = os.environ['LIBMESH_DIR']
    else:
      self.libmesh_dir = os.path.join(self.moose_dir, 'libmesh', 'installed')
    self.file = None

    # Parse arguments
    self.parseCLArgs(argv)

    self.checks = {}
    self.checks['platform'] = getPlatforms()
    self.checks['compiler'] = getCompilers(self.libmesh_dir)
    self.checks['petsc_version'] = getPetscVersion(self.libmesh_dir)
    self.checks['mesh_mode'] = getLibMeshConfigOption(self.libmesh_dir, 'mesh_mode')
    self.checks['dtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'dtk')
    self.checks['library_mode'] = getSharedOption(self.libmesh_dir)
    self.checks['unique_ids'] = getLibMeshConfigOption(self.libmesh_dir, 'unique_ids')
    self.checks['vtk'] =  getLibMeshConfigOption(self.libmesh_dir, 'vtk')
    self.checks['tecplot'] =  getLibMeshConfigOption(self.libmesh_dir, 'tecplot')

    # Override the MESH_MODE option if using '--parallel-mesh' option
    if self.options.parallel_mesh == True or \
          (self.options.cli_args != None and \
          self.options.cli_args.find('--parallel-mesh') != -1):

      option_set = set()
      option_set.add('ALL')
      option_set.add('PARALLEL')
      self.checks['mesh_mode'] = option_set

    method = set()
    method.add('ALL')
    method.add(self.options.method.upper())
    self.checks['method'] = method

    self.initialize(argv, app_name)

  def findAndRunTests(self):
    self.preRun()
    self.start_time = clock()

    # PBS STUFF
    if self.options.pbs and os.path.exists(self.options.pbs):
      self.options.processingPBS = True
      self.processPBSResults()
    else:
      self.options.processingPBS = False
      for dirpath, dirnames, filenames in os.walk(os.getcwd(), followlinks=True):
        if (self.test_match.search(dirpath) and "contrib" not in os.path.relpath(dirpath, os.getcwd())):
          for file in filenames:
            # set cluster_handle to be None initially (happens for each test)
            self.options.cluster_handle = None
            # See if there were other arguments (test names) passed on the command line
            if file == self.options.input_file_name: #and self.test_match.search(file):
              saved_cwd = os.getcwd()
              sys.path.append(os.path.abspath(dirpath))
              os.chdir(dirpath)

              if self.prunePath(file):
                continue

              # Build a Warehouse to hold the MooseObjects
              warehouse = Warehouse()
#.........这里部分代码省略.........
开发者ID:liuwenf,项目名称:moose,代码行数:103,代码来源:TestHarness.py

示例2: buildAndRun

# 需要导入模块: from Factory import Factory [as 别名]
# 或者: from Factory.Factory import loadPlugins [as 别名]
class TestHarness:
    @staticmethod
    def buildAndRun(argv, app_name, moose_dir):
        if "--store-timing" in argv:
            harness = TestTimer(argv, app_name, moose_dir)
        else:
            harness = TestHarness(argv, app_name, moose_dir)

        harness.findAndRunTests()

    def __init__(self, argv, app_name, moose_dir):
        self.factory = Factory()

        # Get dependant applications and load dynamic tester plugins
        # If applications have new testers, we expect to find them in <app_dir>/scripts/TestHarness/testers
        dirs = [os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))]
        sys.path.append(os.path.join(moose_dir, "framework", "scripts"))  # For find_dep_apps.py

        # Use the find_dep_apps script to get the dependant applications for an app
        import find_dep_apps

        depend_app_dirs = find_dep_apps.findDepApps(app_name)
        dirs.extend([os.path.join(my_dir, "scripts", "TestHarness") for my_dir in depend_app_dirs.split("\n")])

        # Finally load the plugins!
        self.factory.loadPlugins(dirs, "testers", Tester)

        self.test_table = []
        self.num_passed = 0
        self.num_failed = 0
        self.num_skipped = 0
        self.num_pending = 0
        self.host_name = gethostname()
        self.moose_dir = moose_dir
        self.run_tests_dir = os.path.abspath(".")
        self.code = "2d2d6769726c2d6d6f6465"
        self.error_code = 0x0
        # Assume libmesh is a peer directory to MOOSE if not defined
        if os.environ.has_key("LIBMESH_DIR"):
            self.libmesh_dir = os.environ["LIBMESH_DIR"]
        else:
            self.libmesh_dir = os.path.join(self.moose_dir, "libmesh", "installed")
        self.file = None

        # Parse arguments
        self.parseCLArgs(argv)

        self.checks = {}
        self.checks["platform"] = getPlatforms()

        # The TestHarness doesn't strictly require the existence of libMesh in order to run. Here we allow the user
        # to select whether they want to probe for libMesh configuration options.
        if self.options.skip_config_checks:
            self.checks["compiler"] = set(["ALL"])
            self.checks["petsc_version"] = "N/A"
            self.checks["library_mode"] = set(["ALL"])
            self.checks["mesh_mode"] = set(["ALL"])
            self.checks["dtk"] = set(["ALL"])
            self.checks["unique_ids"] = set(["ALL"])
            self.checks["vtk"] = set(["ALL"])
            self.checks["tecplot"] = set(["ALL"])
            self.checks["dof_id_bytes"] = set(["ALL"])
            self.checks["petsc_debug"] = set(["ALL"])
            self.checks["curl"] = set(["ALL"])
            self.checks["tbb"] = set(["ALL"])
        else:
            self.checks["compiler"] = getCompilers(self.libmesh_dir)
            self.checks["petsc_version"] = getPetscVersion(self.libmesh_dir)
            self.checks["library_mode"] = getSharedOption(self.libmesh_dir)
            self.checks["mesh_mode"] = getLibMeshConfigOption(self.libmesh_dir, "mesh_mode")
            self.checks["dtk"] = getLibMeshConfigOption(self.libmesh_dir, "dtk")
            self.checks["unique_ids"] = getLibMeshConfigOption(self.libmesh_dir, "unique_ids")
            self.checks["vtk"] = getLibMeshConfigOption(self.libmesh_dir, "vtk")
            self.checks["tecplot"] = getLibMeshConfigOption(self.libmesh_dir, "tecplot")
            self.checks["dof_id_bytes"] = getLibMeshConfigOption(self.libmesh_dir, "dof_id_bytes")
            self.checks["petsc_debug"] = getLibMeshConfigOption(self.libmesh_dir, "petsc_debug")
            self.checks["curl"] = getLibMeshConfigOption(self.libmesh_dir, "curl")
            self.checks["tbb"] = getLibMeshConfigOption(self.libmesh_dir, "tbb")

        # Override the MESH_MODE option if using '--parallel-mesh' option
        if self.options.parallel_mesh == True or (
            self.options.cli_args != None and self.options.cli_args.find("--parallel-mesh") != -1
        ):

            option_set = set(["ALL", "PARALLEL"])
            self.checks["mesh_mode"] = option_set

        method = set(["ALL", self.options.method.upper()])
        self.checks["method"] = method

        self.initialize(argv, app_name)

    """
  Recursively walks the current tree looking for tests to run
  Error codes:
  0x0  - Success
  0x0* - Parser error
  0x1* - TestHarness error
  """

#.........这里部分代码省略.........
开发者ID:rogermue,项目名称:moose,代码行数:103,代码来源:TestHarness.py


注:本文中的Factory.Factory.loadPlugins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。