Example #1
0
    def setUp(self, m_parser, m_timezone, m_pyslurm):

        self.parser = MockConfigParser()
        # Return our instance of MockConfigParser when RawConfigParser is
        # instanciated in neos.conf.ConfLoader
        m_parser.return_value = self.parser
        # pytz.timezone() is used to return a tzinfo given in args to
        # datetime.fromtimestamp(). This method accepts None value, so use this
        # instead of writing a fake tzinfo object.
        m_timezone.return_value = None

        # configuration content for MockConfigParser
        self.parser.conf = {
            'cluster': {
                'name': 'computer',
                'partition': 'cg',
                'wanprefix': '',
            },
            'scenarios': {
                'dir': './neos/scenarios',
                'default': 'xfce4',
            },
            'internals': {
                'basedir': '~/.neos',
                'inenv': '/usr/lib/neos/exec/neos_inenv',
                'mcmd': '/usr/bin/modulecmd',
                'shell': 'bash',
            },
        }
        self.conf = Conf()
        self.loader = ConfLoader('fakepath')
        self.loader.update_conf(self.conf)

        # set environment variables to simulate Slurm job step environment
        set_job_env(1, 0, 'nodes[1-2]', 'cg')
        self.job = Job()
        # neos.scenario.Scenario.__init__() needs to parse SSH_CONNECTION
        # environment variable, then set it here.
        os.environ['SSH_CONNECTION'] = '127.0.0.1 foo'

        self.app = AppInEnv(self.conf, self.job)
Example #2
0
    def load_conf_file(self, conf_path):
        """Parse config file and update app conf accordingly"""

        loader = ConfLoader(conf_path)
        loader.update_conf(self.conf)