當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。