當前位置: 首頁>>代碼示例>>Python>>正文


Python Mock.reset方法代碼示例

本文整理匯總了Python中FedoraReview.Mock.reset方法的典型用法代碼示例。如果您正苦於以下問題:Python Mock.reset方法的具體用法?Python Mock.reset怎麽用?Python Mock.reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FedoraReview.Mock的用法示例。


在下文中一共展示了Mock.reset方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: init_test

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
    def init_test(self, cd, argv=None, wd=None,
                  buildroot=None, options=None):
        '''
        Initiate a test which runs in directory cd
        kwargs:
           argv: fed to sys.argv and eventually to Settings
                 fedora-review is prepended and mock_root appended.
           wd:   review directory, cleared.
           options: mock-options'''

        cd = os.path.abspath(cd)
        os.chdir(cd)
        if not wd:
            wd = os.getcwd()
        ReviewDirs.workdir_setup(wd, 'testing')
        if not argv:
            argv = []
        args = argv
        args.insert(0, 'fedora-review')
        br = buildroot if buildroot else self.BUILDROOT
        args.append("--mock-config=" + br)
        opts = []
        if NO_NET:
            opts.append('--offline')
        if options:
            opts.append(options)
        if opts:
            argv.append('--mock-options=' + ' '.join(opts))
        sys.argv = argv
        Settings.init(True)
        Mock.clear_builddir()
        Mock.reset()
開發者ID:athos-ribeiro,項目名稱:FedoraReview,代碼行數:34,代碼來源:fr_testcase.py

示例2: init_test

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
 def init_test(self, cd, argv=[], wd=None,
               buildroot=None, options=None):
     # Initiate a test which runs in directory cd
     # kwargs:
     #    argv: fed to sys.argv and eventually to Settings
     #          fedora-review is prepended and mock_root appended.
     #    wd:   review directory, cleared.
     #    options: mock-options
     os.chdir(cd)
     if wd:
         if os.path.exists(wd):
             shutil.rmtree(wd)
     ReviewDirs.reset(cd)
     ReviewDirs.workdir_setup(os.getcwd(), True)
     args = argv
     args.insert(0, 'fedora-review')
     br = buildroot if buildroot else self.BUILDROOT
     args.append("--mock-config=" + br)
     opts = []
     if NO_NET:
         opts.append('--offline')
     if options:
         opts.append(options)
     if opts:
         argv.append('--mock-options=' +  ' '.join(opts))
     sys.argv = argv
     Settings.init(True)
     Mock.reset()
開發者ID:pombredanne,項目名稱:FedoraReview,代碼行數:30,代碼來源:fr_testcase.py

示例3: test_mock_configdir

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
 def test_mock_configdir(self):
     self.init_test('test_misc',
                    argv=['-n','python-test'],
                    buildroot='default',
                    options='--configdir=mock-config')
     Mock.reset()
     Mock._get_root()
     self.assertEqual(Mock.mock_root, 'fedora-12-i786')
開發者ID:pombredanne,項目名稱:FedoraReview,代碼行數:10,代碼來源:test_misc.py

示例4: setUp

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
 def setUp(self):
     FR_TestCase.setUp(self)
     sys.argv = ['fedora-review', '-b', '1']
     Settings.init(True)
     self.spec_file = os.path.join(os.path.abspath('.'),
                                   'test_regressions',
                                   'test_107_1.spec')
     self.srpm_file = os.path.join(os.path.abspath('.'),
                                   'test_regressions',
                                   'test_107_1-1.0-1.fc17.src.rpm')
     Mock.reset()
開發者ID:athos-ribeiro,項目名稱:FedoraReview,代碼行數:13,代碼來源:test_regressions.py

示例5: setUp

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
 def setUp(self):
     if not srcpath.PLUGIN_PATH in sys.path:
         sys.path.append(srcpath.PLUGIN_PATH)
     sys.argv = ['fedora-review', '-b', '1']
     Settings.init(True)
     self.log = Settings.get_logger()
     self.helpers = HelpersMixin()
     self.srpm_file = os.path.join(os.path.abspath('.'),
                                   'test_misc',
                                   'python-test-1.0-1.fc17.src.rpm')
     self.startdir = os.getcwd()
     Mock.reset()
開發者ID:athos-ribeiro,項目名稱:FedoraReview,代碼行數:14,代碼來源:test_misc.py

示例6: setUp

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
 def setUp(self):
     sys.argv = ['fedora-review', '-b', '1']
     Settings.init(True)
     self.log = Settings.get_logger()
     self.helpers = HelpersMixin()
     self.srpm_file = os.path.join(os.path.abspath('.'),
                                   'test_misc',
                                   'python-test-1.0-1.fc16.src.rpm')
     self.spec_file = os.path.join(Mock.get_builddir('SOURCES'),
                                   'python-test.spec')
     self.startdir = os.getcwd()
     Mock.reset()
開發者ID:pombredanne,項目名稱:FedoraReview,代碼行數:14,代碼來源:test_misc.py

示例7: setUp

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
 def setUp(self):
     sys.argv = ['fedora-review', '-b', '1']
     self.startdir = os.getcwd()
     Settings.init(True)
     self.log = Settings.get_logger()
     self.helpers = HelpersMixin()
     self.spec_file = os.path.join(os.path.abspath('.'),
                                   'test_regressions',
                                   'test_107_1.spec')
     self.srpm_file = os.path.join(os.path.abspath('.'),
                                   'test_regressions',
                                   'test_107_1-1.0-1.fc17.src.rpm')
     Mock.reset()
開發者ID:pombredanne,項目名稱:FedoraReview,代碼行數:15,代碼來源:test_regressions.py

示例8: setUp

# 需要導入模塊: from FedoraReview import Mock [as 別名]
# 或者: from FedoraReview.Mock import reset [as 別名]
 def setUp(self):
     sys.argv = ['fedora-review','-n','python-test','--prebuilt']
     Settings.init(True)
     ReviewDirs.reset()
     ReviewDirs.workdir_setup('.', True)
     self.log = Settings.get_logger()
     self.helpers = Helpers()
     self.srpm_file = os.path.join(os.path.abspath('.'),
                                   os.path.basename(TEST_SRPM))
     self.spec_file = os.path.join(Mock.get_builddir('SOURCES'),
                                     os.path.basename(TEST_SPEC))
     self.source_file = os.path.join(Mock.get_builddir('SOURCES'),
                                     os.path.basename(TEST_SRC))
     if not os.path.exists(TEST_WORK_DIR):
         os.makedirs(TEST_WORK_DIR)
     self.helpers._get_file(TEST_SRPM, TEST_WORK_DIR)
     self.startdir = os.getcwd()
     for tree in ['python-test', 'results']:
         if os.path.exists(tree):
             shutil.rmtree(tree)
     Mock.reset()
開發者ID:hadrons123,項目名稱:FedoraReview,代碼行數:23,代碼來源:test_misc.py


注:本文中的FedoraReview.Mock.reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。