Пример #1
0
    def test_default_config(self):
        """Test that the default configuration is created"""
        config = Config(ROOTDIR)
        self.assertTrue(config)

        expected_string = "idk:\n  working_repo: %s\n" % config.get("working_repo")

        self.assertEqual(expected_string, self.read_config())
        self.assertTrue(config.get("working_repo"))
        self.assertTrue(config.get("template_dir"))
        self.assertTrue(config.get("couchdb"))
        self.assertTrue(config.get("rabbit-server"))
Пример #2
0
    def __init__(self, metadata, log_file=None):
        """
        @brief Constructor
        @param metadata IDK Metadata object
        @param log_file File to store test results.  If none specified log to STDOUT
        """
        repo_dir = Config().get("working_repo")
        if (not repo_dir):
            raise IDKConfigMissing()

        # Ion scripts need to be run from the base os the repo dir so it has access
        # to resources using relative pathing.  So we just do
        os.chdir(repo_dir)

        self.metadata = metadata
        if (not self.metadata.driver_name):
            raise DriverNotStarted()

        if (log_file):
            self.log_fh = open(log_file, "w")
        else:
            self.log_fh = sys.stdout

        config_path = "%s/%s" % (self.metadata.driver_dir(),
                                 CommConfig.config_filename())
        self.comm_config = CommConfig.get_config_from_file(config_path)
        if (not self.comm_config):
            raise CommConfigReadFail(msg=config_path)

        self.test_runner = nose.core.TextTestRunner(stream=self.log_fh)
Пример #3
0
 def driver_modulename(self):
     """
     @brief module name of the new driver tests
     @retval driver test module name
     """
     return self.driver_path().replace(Config().base_dir() + "/",
                                       '').replace('/',
                                                   '.').replace('.py', '')
Пример #4
0
    def test_overloaded_config(self):
        """Test that the overloaded configuration"""
        # Build the default config and add a line
        config = Config(ROOTDIR)
        self.write_config()
        self.assertTrue(config)

        # reload the configuration
        config.cm.init(ROOTDIR)

        expected_string = "idk:\n  working_repo: %s\n  couchdb: %s" % (config.get("working_repo"), config.get("couchdb"))

        self.assertEqual(expected_string, self.read_config())
        self.assertEqual(config.get("couchdb"), "couchdb")
        self.assertTrue(config.get("working_repo"))
        self.assertTrue(config.get("template_dir"))
        self.assertTrue(config.get("rabbit-server"))
Пример #5
0
    def driver_make_dir(self):
        """
        @brief full path to the driver make dir
        @retval driver make path
        """
        if not self.metadata.driver_make:
            raise DriverParameterUndefined("driver_make undefined in metadata")

        return os.path.join(Config().base_dir(), "mi", "instrument",
                            self.metadata.driver_make.lower())
Пример #6
0
    def setUp(self):
        """
        Setup the test case
        """
        Config().cm.destroy()

        if not exists(ROOTDIR):
            makedirs(ROOTDIR)

        if exists(self.config_file()):
            log.debug("remove test dir %s" % self.config_file())
            remove(self.config_file())
        self.assertFalse(exists(self.config_file()))
Пример #7
0
    def comm_config_file(self):
        """
        @brief Return the path the the driver comm config yaml file.
        @return if comm_config.yml exists return the full path
        """
        repo_dir = Config().get('working_repo')
        driver_path = self._test_config.driver_module
        p = re.compile('\.')
        driver_path = p.sub('/', driver_path)
        abs_path = "%s/%s/%s" % (repo_dir, os.path.dirname(driver_path),
                                 CommConfig.config_filename())

        log.debug(abs_path)
        return abs_path
Пример #8
0
    def test_default_config(self):
        """Test that the default configuration is created"""
        config = Config(ROOTDIR)
        self.assertTrue(config)

        expected_string = "idk:\n  working_repo: %s\n" % config.get(
            "working_repo")

        self.assertEqual(expected_string, self.read_config())
        self.assertTrue(config.get("working_repo"))
        self.assertTrue(config.get("template_dir"))
        self.assertTrue(config.get("couchdb"))
        self.assertTrue(config.get("rabbit-server"))
Пример #9
0
    def test_overloaded_config(self):
        """Test that the overloaded configuration"""
        # Build the default config and add a line
        config = Config(ROOTDIR)
        self.write_config()
        self.assertTrue(config)

        # reload the configuration
        config.cm.init(ROOTDIR)

        expected_string = "idk:\n  working_repo: %s\n  couchdb: %s" % (
            config.get("working_repo"), config.get("couchdb"))

        self.assertEqual(expected_string, self.read_config())
        self.assertEqual(config.get("couchdb"), "couchdb")
        self.assertTrue(config.get("working_repo"))
        self.assertTrue(config.get("template_dir"))
        self.assertTrue(config.get("rabbit-server"))
Пример #10
0
 def template_dir(self):
     """
     @brief path to the driver template dir
     @retval driver test code template path
     """
     return Config().template_dir()
Пример #11
0
 def run(self):
     """
     @brief Run it.
     """
     log.info( "*** IDK Rebase Process***" )
     Config().rebase()
Пример #12
0
 def idk_dir(self):
     """
     @brief directory to store the idk driver configuration
     @retval dir name
     """
     return Config().idk_config_dir()