def test_open(self):
        """Test openning a configuration file
        """
        config = Configuration.read(
            os.path.join(get_test_file_directory(), "configuration.cfg"))
        self.assertNotEqual(config, None)
        self.failUnless(isinstance(config, Configuration))

        self.assertRaises(FileError, Configuration.read, "not_existing")
Beispiel #2
0
 def __call__(self, distribution, path, interpretor, trust=-99):
     setup_cfg = os.path.join(path, 'monteur.cfg')
     if os.path.isfile(setup_cfg):
         configuration = Configuration.read(setup_cfg)
         if 'egginfo' in configuration.sections:
             return SetupLoader(configuration, distribution, interpretor)
         logger.debug(
             u"Missing monteur package configuration in %s",
             setup_cfg)
     return None
Beispiel #3
0
 def get_previous_cfg(self, *ignore):
     """Return a previous configuration used to setup this environment.
     """
     directory = self.get_previous_cfg_directory()
     if directory is not None:
         filename = os.path.join(directory, PREVIOUS_CONFIG_FILE)
         if os.path.isfile(filename):
             logger.info(u'Loading previous configuration')
             return Configuration.read(filename)
     return Configuration()
Beispiel #4
0
 def get_default_cfg(self):
     """Return the default configuration.
     """
     directory = self.get_default_cfg_directory()
     filename = os.path.join(directory, DEFAULT_CONFIG_FILE)
     if not os.path.isfile(filename):
         try:
             shutil.copy(
                 os.path.join(os.path.dirname(__file__), 'default.cfg'),
                 filename)
         except IOError:
             sys.stderr.write('Cannot install default configuration.')
             sys.exit(-1)
     logger.info(u'Reading default configuration.')
     return Configuration.read(filename)
 def setUp(self):
     self.config = Configuration.read(
         os.path.join(get_test_file_directory(), "configuration.cfg"))
     self.section = self.config['section']