本文整理汇总了Python中FedoraReview.name_bug.NameBug类的典型用法代码示例。如果您正苦于以下问题:Python NameBug类的具体用法?Python NameBug怎么用?Python NameBug使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NameBug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dirty_resultdir
def test_dirty_resultdir(self):
''' Test that non-empty resultdir quits. '''
self.init_test('test_misc',
argv=['-n', 'python-test', '--cache'])
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file).get_checks()
checks.set_single_check('CheckResultdir')
check = checks['CheckResultdir']
if not os.path.exists('results.bak'):
os.makedirs('results.bak')
for dirt in glob.glob('results/*.*'):
shutil.move(dirt, 'results.bak')
check.run()
self.assertTrue(check.is_na)
try:
subprocess.check_call('touch results/orvar.rpm', shell=True)
except OSError:
pass
self.assertRaises(ReviewError, check.run)
Settings.nobuild = True
check.run()
self.assertTrue(check.is_na)
os.unlink('results/orvar.rpm')
for dirt in glob.glob('results.bak/*'):
shutil.move(dirt, 'results')
示例2: test_exclude
def test_exclude(self):
''' test --exclude/-x option. '''
self.init_opt_test(['-n', 'python-test', '-x', 'CheckRequires',
'--cache'])
bug = NameBug(Settings.name)
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
self.assertTrue(checks.checkdict['CheckRequires'].result is None)
示例3: test_flags_2
def test_flags_2(self):
''' Flag defined in python, not set by user' '''
self.init_test('test_misc',
argv=['-n', 'python-test', '--cache',
'--no-build'])
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
self.assertFalse(checks.flags['EPEL5'])
示例4: test_single
def test_single(self):
''' test --single/-s option '''
self.init_opt_test(['-n', 'python-test', '-s', 'CheckRequires',
'--cache'])
bug = NameBug(Settings.name)
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
check = checks.checkdict['CheckRequires']
self.assertEqual(check.name, 'CheckRequires')
示例5: test_rpm_spec
def test_rpm_spec(self):
''' Internal -r check. '''
self.init_test('test_misc',
argv=['-rn', 'python-test', '--cache',
'--no-build'])
bug = NameBug('python-test')
bug.find_urls()
expected = 'test/test_misc/python-test-1.0-1.fc17.src.rpm'
self.assertTrue(bug.srpm_url.endswith(expected))
expected = 'test/test_misc/srpm-unpacked/python-test.spec'
self.assertTrue(bug.spec_url.endswith(expected))
示例6: test_flags_3
def test_flags_3(self):
''' Flag not defined , set by user' '''
self.init_test('test_misc',
argv=['-n', 'python-test', '--cache',
'--no-build', '-D', 'EPEL8'])
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
with self.assertRaises(ReviewError):
# pylint: disable=W0612
checks = Checks(bug.spec_file, bug.srpm_file)
示例7: test_local_repo
def test_local_repo(self):
''' Local repo with prebuilt rpms test. '''
self.init_test('test_misc',
argv=['-rn', 'python-test', '--local-repo',
'repo', '--cache'])
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
check = checks.checkdict['CheckPackageInstalls']
check.run()
self.assertTrue(check.is_passed)
示例8: test_107_source_same_as_name
def test_107_source_same_as_name(self):
""" Test the case when Source is equal to %{name}
"""
srpm_file = os.path.join(os.path.abspath('.'),
'test_regressions',
'test_107_2-1.0-1.fc17.src.rpm')
self.init_test('test_regressions',
argv=['-rn', srpm_file, '--cache'])
bug = NameBug(srpm_file)
bug.find_urls()
self.assertNotEqual(None, bug.srpm_file)
self.assertNotEqual(None, bug.spec_file)
示例9: test_prebuilt_sources
def test_prebuilt_sources(self):
''' Local built RPM:s (-n) test. '''
self.init_test('test_misc',
argv=['-cn', 'python-test', '--prebuilt'])
ReviewDirs.startdir = os.getcwd()
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
subprocess.check_call('touch orvar.rpm', shell=True)
rpms = Mock.get_package_rpm_paths(checks.spec)
self.assertEqual(len(rpms), 1)
示例10: test_flags_4
def test_flags_4(self):
''' Flag defined in shell script , set by user to value '''
os.environ['XDG_DATA_HOME'] = os.getcwd()
self.init_test('test_misc',
argv=['-n', 'python-test', '--cache',
'--no-build', '-D', 'EPEL6=foo'])
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
self.assertEqual(str(checks.flags['EPEL6']), 'foo')
示例11: test_sh_api
def test_sh_api(self):
''' Basic shell API test. '''
self.init_test('test_ext',
argv=['-pn', 'python-test', '--cache',
'--no-build'],
wd='review-python-test')
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
checks.checkdict['CreateEnvCheck'].run()
checks.checkdict['unittest-test2'].run()
self.assertTrue(checks.checkdict['unittest-test2'].is_pending)
示例12: test_prebuilt
def test_prebuilt(self):
''' test --name --prebuilt '''
argv = ['-rpn', 'python-spiffgtkwidgets', '--cache']
self.init_test('prebuilt', argv=argv)
bug = NameBug('python-spiffgtkwidgets')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
check = checks.checkdict['CheckBuild']
check.run()
self.assertTrue(check.is_pending)
self.assertIn('Using prebuilt packages',
check.result.output_extra)
示例13: test_bad_specname
def test_bad_specname(self):
''' Specfile with bad name test. '''
loglevel = os.environ['REVIEW_LOGLEVEL']
os.environ['REVIEW_LOGLEVEL'] = 'ERROR'
self.init_test('bad-specname',
argv=['-rn', 'python-test', '--cache'])
os.environ['REVIEW_LOGLEVEL'] = loglevel
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
check = checks.checkdict['CheckSpecAsInSRPM']
check.run()
self.assertTrue(check.is_failed)
self.assertIn('Bad spec filename:', check.result.output_extra)
示例14: test_perl_module
def test_perl_module(self):
''' test basic perl python + shell test '''
self.init_test('perl',
argv=['-rpn', 'perl-RPM-Specfile', '--no-build'])
bug = NameBug('perl-RPM-Specfile')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file)
checks.checkdict['CreateEnvCheck'].run()
check = checks.checkdict['PerlCheckBuildRequires']
check.run()
self.assertTrue(check.is_pending)
check = checks.checkdict['perl-url-tag']
check.run()
self.assertTrue(check.is_pending)
示例15: test_md5sum_diff_ok
def test_md5sum_diff_ok(self):
''' Complete MD5sum test expected to pass. '''
self.init_test('md5sum-diff-ok',
argv=['-rpn', 'python-test', '--cache',
'--no-build'])
bug = NameBug('python-test')
bug.find_urls()
bug.download_files()
checks = Checks(bug.spec_file, bug.srpm_file).get_checks()
checks.set_single_check('CheckSourceMD5')
check = checks['CheckSourceMD5']
check.run()
self.assertTrue(check.is_passed)
expected = 'diff -r shows no differences'
self.assertTrue(expected in check.result.attachments[0].text)