本文整理汇总了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)
示例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)
示例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)
示例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)