Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
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)