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


Python DriverGenerator.test_modulename方法代码示例

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


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

示例1: __init__

# 需要导入模块: from mi.idk.driver_generator import DriverGenerator [as 别名]
# 或者: from mi.idk.driver_generator.DriverGenerator import test_modulename [as 别名]
    def __init__(self, launch_monitor=False):
        """
        Setup the direct access server
        """
        # Currently we are pulling the driver config information from the driver tests.  There is a better way to do
        # this, but we are time crunched.  TODO: Fix this!

        generator = DriverGenerator(Metadata())
        __import__(generator.test_modulename())
        self.test_config = InstrumentDriverTestConfig()

        # Test to ensure we have initialized our test config
        if not self.test_config.initialized:
            raise TestNotInitialized(msg="Tests non initialized. Missing InstrumentDriverTestCase.initalize(...)?")

        self.launch_monitor = launch_monitor
开发者ID:JeffRoy,项目名称:marine-integrations,代码行数:18,代码来源:da_server.py

示例2: _driver_test_module

# 需要导入模块: from mi.idk.driver_generator import DriverGenerator [as 别名]
# 或者: from mi.idk.driver_generator.DriverGenerator import test_modulename [as 别名]
 def _driver_test_module(self):
     generator = DriverGenerator(self.metadata)
     return generator.test_modulename()
开发者ID:ccenter,项目名称:marine-integrations,代码行数:5,代码来源:nose_test.py

示例3: __init__

# 需要导入模块: from mi.idk.driver_generator import DriverGenerator [as 别名]
# 或者: from mi.idk.driver_generator.DriverGenerator import test_modulename [as 别名]
class EggGenerator:
    """
    Generate driver egg
    """

    def __init__(self, metadata):
        """
        @brief Constructor
        @param metadata IDK Metadata object
        """
        self.metadata = metadata
        self._bdir = None

        if not self._tmp_dir():
            raise InvalidParameters("missing tmp_dir configuration")

        if not self._tmp_dir():
            raise InvalidParameters("missing working_repo configuration")

        self.generator = DriverGenerator(self.metadata)
        test_import = __import__(self._test_module())

    def _test_module(self):
        return self.generator.test_modulename()

    def _driver_module(self):
        test_config = InstrumentDriverTestConfig()
        return test_config.driver_module

    def _driver_class(self):
        test_config = InstrumentDriverTestConfig()
        return test_config.driver_class

    def _repo_dir(self):
        return Config().get('working_repo')

    def _tmp_dir(self):
        return Config().get('tmp_dir')

    def _setup_path(self):
        return os.path.join(self._build_dir(), 'setup.py' )

    def _setup_template_path(self):
        return os.path.join(Config().template_dir(), 'setup.tmpl' )

    def _main_path(self):
        return os.path.join(self._build_dir(), 'mi/main.py' )

    def _main_template_path(self):
        return os.path.join(Config().template_dir(), 'main.tmpl' )

    def _build_name(self):
        return "%s_%s_%s_%s" % (
                self.metadata.driver_make,
                self.metadata.driver_model,
                self.metadata.driver_name,
                self.metadata.version,
            )

    def _build_dir(self):
        if self._bdir:
            return self._bdir

        self._bdir = self._generate_build_dir()

        log.info( "egg build dir: %s" % self._bdir)
        return self._bdir

    def _generate_build_dir(self):
        original_dir = os.path.join(self._tmp_dir(), self._build_name())
        build_dir = original_dir
        build_count = 1

        # Find a directory that doesn't exist
        while os.path.exists(build_dir):
            build_dir = "%s.%03d" % (original_dir, build_count)
            log.debug("build dir test: %s" % build_dir)
            build_count += 1

        return build_dir

    def _stage_files(self, files):
        if not os.path.exists(self._build_dir()):
            os.makedirs(self._build_dir())


        for file in files:
            dest = os.path.join(self._build_dir(), file)
            destdir = dirname(dest)
            source = os.path.join(self._repo_dir(), file)

            log.debug(" Copy %s => %s" % (source, dest))

            if not os.path.exists(destdir):
                os.makedirs(destdir)

            shutil.copy(source, dest)

    def _get_template(self, template_file):
        """
#.........这里部分代码省略.........
开发者ID:ccenter,项目名称:marine-integrations,代码行数:103,代码来源:egg_generator.py

示例4: __init__

# 需要导入模块: from mi.idk.driver_generator import DriverGenerator [as 别名]
# 或者: from mi.idk.driver_generator.DriverGenerator import test_modulename [as 别名]
class EggGenerator:
    """
    Generate driver egg
    """

    def __init__(self, metadata, repo_dir=REPODIR):
        """
        @brief Constructor
        @param metadata IDK Metadata object
        """
        self.metadata = metadata
        self._bdir = None
        self._repodir = repo_dir

        if not self._tmp_dir():
            raise InvalidParameters("missing tmp_dir configuration")

        if not self._tmp_dir():
            raise InvalidParameters("missing working_repo configuration")

        self.generator = DriverGenerator(self.metadata)
        test_import = __import__(self._test_module())

    def _test_module(self):
        return self.generator.test_modulename()

    def _driver_module(self):
        test_config = InstrumentDriverTestConfig()
        return test_config.driver_module

    def _driver_class(self):
        test_config = InstrumentDriverTestConfig()
        return test_config.driver_class

    def _repo_dir(self):
        return self._repodir
    
    def _res_dir(self):
        return os.path.join(self._versioned_dir(), 'res')
    
    def _res_config_dir(self):
        return os.path.join(self._res_dir(), 'config' )

    def _tmp_dir(self):
        return Config().get('tmp_dir')

    def _setup_path(self):
        return os.path.join(self._build_dir(), 'setup.py' )

    def _setup_template_path(self):
        return os.path.join(Config().template_dir(), 'setup.tmpl' )

    def _main_path(self):
        return os.path.join(self._versioned_dir(), 'mi/main.py' )

    def _main_template_path(self):
        return os.path.join(Config().template_dir(), 'main.tmpl' )

    def _build_name(self):
        return "%s_%s_%s_%s" % (
                self.metadata.driver_make,
                self.metadata.driver_model,
                self.metadata.driver_name,
                self.metadata.version.replace('.', '_'),
            )

    def _build_dir(self):
        if self._bdir:
            return self._bdir

        self._bdir = self._generate_build_dir()

        log.info( "egg build dir: %s" % self._bdir)
        return self._bdir

    def _generate_build_dir(self):
        build_dir = os.path.join(self._tmp_dir(), self._build_name())
        # clean out an old build if it exists
        if os.path.exists(build_dir):
            shutil.rmtree(build_dir)
        return build_dir

    def _versioned_dir(self):
        return self._build_dir()
        #return os.path.join(self._build_dir(),
        #                    self._build_name())

    def _stage_files(self, files):
        """
        Copy files from the original directory into two levels of versioned
        directories within a staging directory, and replace the mi namespace
        with the versioned driver name.mi to account for the new directory
        (only the lower versioned dir is included in the egg)
        @param files - a list of files to copy into the staging directory
        """
        log.error(repr(files))
        # make two levels of versioned file directories, i.e.
        #     driverA_0_1 (= build_dir)
        #         driverA_0_1 (= versioned_dir)
        # then copy driverA files into the bottom versioned dir
#.........这里部分代码省略.........
开发者ID:j2project,项目名称:marine-integrations,代码行数:103,代码来源:egg_generator.py


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