示例#1
0
 def _setup_test_modules(self, files):
     with namedTemporaryDir() as path:
         for f in files:
             utils.touchFile(os.path.join(path, f))
         utils.touchFile(os.path.join(path, '__init__.py'))
         sys.path.append(os.path.dirname(path))
         yield importlib.import_module(os.path.basename(path))
示例#2
0
 def _setup_test_modules(self, files):
     with namedTemporaryDir() as path:
         for f in files:
             utils.touchFile(os.path.join(path, f))
         utils.touchFile(os.path.join(path, '__init__.py'))
         sys.path.append(os.path.dirname(path))
         yield importlib.import_module(os.path.basename(path))
示例#3
0
 def testListConfiguratorsModulesFolder(self, files, expected_modules):
     expected = set(expected_modules)
     with namedTemporaryDir() as path:
         for f in files:
             utils.touchFile(os.path.join(path, f))
         result = configurator._listmodules(path)
     self.assertEquals(
         result,
         expected,
     )
示例#4
0
 def testListConfiguratorsModulesFolder(self, files, expected_modules):
     expected = set(expected_modules)
     with namedTemporaryDir() as path:
         for f in files:
             utils.touchFile(os.path.join(path, f))
         result = configurator._listmodules(path)
     self.assertEquals(
         result,
         expected,
     )
示例#5
0
文件: toolTests.py 项目: fzkbass/vdsm
    def setUp(self):
        self._test_dir = tempfile.mkdtemp()

        test_env['LCONF'] = self._test_dir + '/libvirtd.conf'
        test_env['QCONF'] = self._test_dir + '/qemu.conf'
        test_env['LDCONF'] = self._test_dir + '/qemu-sanlock.conf'
        test_env['QLCONF'] = self._test_dir + '/libvirtd'
        test_env['LIBVIRT_LOGROTATE'] = \
            self._test_dir + '/logrotate-libvirtd'
        test_env['VDSM_CONF_FILE'] = self._test_dir + '/vdsm.conf'
        test_env['FORCE_RECONFIGURE'] = self._test_dir + '/reconfigure'

        utils.touchFile(test_env['LIBVIRT_LOGROTATE'])
        self._setConfig('QLCONF', 'libvirtd')
        self._setConfig('QCONF', 'qemu')
        self._setConfig('LDCONF', 'qemu-sanlock')
        self.patch = monkeypatch.Patch([(os, 'getuid', lambda: 0),
                                        (configurator.LibvirtModuleConfigure,
                                         '_get_libvirt_exec', get_libvirt_exec)
                                        ])
        self.patch.apply()
示例#6
0
文件: toolTests.py 项目: fzkbass/vdsm
    def setUp(self):
        self._test_dir = tempfile.mkdtemp()

        test_env['LCONF'] = self._test_dir + '/libvirtd.conf'
        test_env['QCONF'] = self._test_dir + '/qemu.conf'
        test_env['LDCONF'] = self._test_dir + '/qemu-sanlock.conf'
        test_env['QLCONF'] = self._test_dir + '/libvirtd'
        test_env['LIBVIRT_LOGROTATE'] = \
            self._test_dir + '/logrotate-libvirtd'
        test_env['VDSM_CONF_FILE'] = self._test_dir + '/vdsm.conf'
        test_env['FORCE_RECONFIGURE'] = self._test_dir + '/reconfigure'

        utils.touchFile(test_env['LIBVIRT_LOGROTATE'])
        self._setConfig('QLCONF', 'libvirtd')
        self._setConfig('QCONF', 'qemu')
        self._setConfig('LDCONF', 'qemu-sanlock')
        self.patch = monkeypatch.Patch([
            (os, 'getuid', lambda: 0),
            (configurator.LibvirtModuleConfigure,
             '_get_libvirt_exec',
             get_libvirt_exec)
        ])
        self.patch.apply()