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


Python Mock.init方法代码示例

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


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

示例1: _mock_root_setup

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import init [as 别名]
def _mock_root_setup(while_what, force=False):
    ''' Wrap mock --init. '''

    class DependencyInstallError(ReviewError):
        ''' Raised when a package in local repo can't be installed. '''
        pass

    Mock.init(force)
    if Settings.repo:
        repodir = Settings.repo
        if not repodir.startswith('/'):
            repodir = os.path.join(ReviewDirs.startdir, repodir)
        rpms = glob.glob(os.path.join(repodir, '*.rpm'))
        error = Mock.install(rpms)
        if error:
            raise DependencyInstallError(while_what + ': ' + error)
开发者ID:timlau,项目名称:FedoraReview,代码行数:18,代码来源:generic_build.py

示例2: test_mock_uniqueext

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import init [as 别名]
 def test_mock_uniqueext(self):
     self.init_test('test_misc',
                    argv=['-n','python-test'],
                    options='--uniqueext=hugo')
     bug = NameBug('python-test')
     bug.find_urls()
     bug.download_files()
     checks = Checks(bug.spec_file, bug.srpm_file)
     Mock.init()
     for dirt in glob.glob('results/*.*'):
         os.unlink(dirt)
     check = checks.checkdict['CheckBuild']
     check.run()
     self.assertTrue(check.is_passed)
     results = glob.glob('results/*.rpm')
     self.assertEqual(len(results), 2)
     for dirt in glob.glob('results/*.*'):
         os.unlink(dirt)
开发者ID:pombredanne,项目名称:FedoraReview,代码行数:20,代码来源:test_misc.py

示例3: test_mock_uniqueext

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import init [as 别名]
 def test_mock_uniqueext(self):
     ''' Test --uniqueext option. '''
     loglevel = os.environ['REVIEW_LOGLEVEL']
     os.environ['REVIEW_LOGLEVEL'] = 'ERROR'
     self.init_test('mock-uniqueext',
                    argv=['-cn', 'python-test'],
                    options='--uniqueext=hugo')
     os.environ['REVIEW_LOGLEVEL'] = loglevel
     bug = NameBug('python-test')
     bug.find_urls()
     bug.download_files()
     checks = Checks(bug.spec_file, bug.srpm_file)
     Mock.init()
     for dirt in glob.glob('results/*.*'):
         os.unlink(dirt)
     check = checks.checkdict['CheckBuild']
     check.run()
     self.assertTrue(check.is_passed)
     results = glob.glob('results/*.rpm')
     self.assertEqual(len(results), 2)
     for dirt in glob.glob('results/*.*'):
         os.unlink(dirt)
开发者ID:athos-ribeiro,项目名称:FedoraReview,代码行数:24,代码来源:test_misc.py

示例4: eval

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import init [as 别名]
import os.path
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0,os.path.abspath('../'))

import unittest

from FedoraReview  import Mock

from test_misc     import TestMisc
from test_bugzilla import TestBugzilla
from test_checks   import TestChecks
from test_R_checks import TestRChecks
from test_options  import TestOptions
from test_util     import TestUtil
from test_ext      import TestExt

from test_env      import no_net

VERBOSITY = 2

if no_net:
    print "Warning:  No network available, only some tests run"
if not 'REVIEW_LOGLEVEL' in os.environ:
    print "Warning:  REVIEW_LOGLEVEL not set, lot's of output ahead."

Mock.init()

for t in 'Misc', 'Bugzilla', 'Checks', 'RChecks', 'Options', 'Util', 'Ext':
   test = eval( 'unittest.TestLoader().loadTestsFromTestCase(Test%s)' % t)
   unittest.TextTestRunner(verbosity=VERBOSITY).run(test)
开发者ID:hadrons123,项目名称:FedoraReview,代码行数:32,代码来源:run-tests.py


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