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


Python Mock.clear_builddir方法代码示例

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


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

示例1: init_test

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import clear_builddir [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: test_mockbuild

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import clear_builddir [as 别名]
 def test_mockbuild(self):
     """ Test the SRPMFile class """
     self.init_test('mockbuild', argv=['-rn', 'python-test'])
     srpm = SRPMFile(self.srpm_file)
     # install the srpm
     srpm.unpack()
     self.assertTrue(srpm._unpacked_src is not None)
     src_dir = srpm._unpacked_src
     src_files = glob.glob(os.path.expanduser(src_dir) + '/*')
     src_files = [os.path.basename(f) for f in src_files]
     self.assertTrue('python-test-1.0.tar.gz' in src_files)
     self.log.info("Starting mock build (patience...)")
     Mock.clear_builddir()
     Mock.build(srpm.filename)
     rpms = glob.glob(os.path.join(Mock.resultdir,
                                   'python-test-1.0-1*noarch.rpm'))
     self.assertEqual(1, len(rpms))
开发者ID:athos-ribeiro,项目名称:FedoraReview,代码行数:19,代码来源:test_misc.py

示例3: run_spec

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import clear_builddir [as 别名]
    def run_spec(self, spec):
        ''' Run all tests for a test spec.... '''
        # pylint: disable=C0111,W0212

        class Null(object):
            def write(self, msg):
                pass

        argv = ['-rn', spec.testcase, '-x', 'generic-large-docs',
                '--no-build']
        argv.extend(spec.args)
        self.init_test(spec.testcase, wd=spec.workdir, argv=argv)
        helper = ReviewHelper()
        Mock.clear_builddir()
        if os.path.exists('BUILD'):
            if os.path.islink('BUILD'):
                os.unlink('BUILD')
            else:
                shutil.rmtree('BUILD')
        stdout = sys.stdout
        sys.stdout = Null()
        rc = helper.run('review.txt')
        self.assertEqual(rc, 0)
        sys.stdout = stdout
        checkdict = helper.checks.get_checks()
        for check in checkdict.itervalues():
            self.assertTrue(check.is_run)
            if check.is_passed or check.is_pending or check.is_failed:
                self.assertIn(check.group, spec.groups_ok,
                              check.name + ': group is ' + check.group)
        for (what, check) in spec.expected:
            state = checkdict[check].state
            if what in ['pass', 'fail', 'pending']:
                self.assertEqual(state, what,
                                 check + ': state is ' + str(state))
            elif what == 'na':
                self.assertEqual(state, None,
                                 check + ': state is ' + str(state))
            elif what.startswith == 'in_attachment':
                self.assertIn(what.split(':')[1],
                              checkdict[check].attachments[0].text)
            else:
                self.assertFalse(what)
开发者ID:athos-ribeiro,项目名称:FedoraReview,代码行数:45,代码来源:fr_testcase.py

示例4: run

# 需要导入模块: from FedoraReview import Mock [as 别名]
# 或者: from FedoraReview.Mock import clear_builddir [as 别名]
 def run(self):
     if not Mock.is_available():
         self.set_passed(self.NA)
         return
     Mock.clear_builddir()
     errmsg = Mock.rpmbuild_bp(self.srpm)
     if errmsg:
         self.log.debug(
             "Cannot do rpmbuild -bp, trying with builddeps")
         Mock.install(self.spec.build_requires)
         Mock.rpmbuild_bp(self.srpm)
     if os.path.lexists('BUILD'):
         if os.path.islink('BUILD'):
             os.unlink('BUILD')
         else:
             shutil.rmtree('BUILD')
     os.symlink(Mock.get_builddir('BUILD'), 'BUILD')
     self.log.info('Active plugins: ' +
                       ', '.join(self.checks.get_plugins(True)))
     self.set_passed(self.NA, None, [self.setup_attachment()])
开发者ID:athos-ribeiro,项目名称:FedoraReview,代码行数:22,代码来源:generic_build.py


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