def testFindRpmbuild_missing(self): with make_rpm.Tempdir() as outer: with ReplacePath([outer]): with self.assertRaises( make_rpm.NoRpmbuildFoundError) as context: make_rpm.FindRpmbuild('') self.assertIsNotNone(context)
def testFindRpmbuild_present(self): with make_rpm.Tempdir() as outer: dummy = os.sep.join([outer, 'rpmbuild']) WriteFile(dummy, 'dummy rpmbuild') os.chmod(dummy, 0o777) with PrependPath([outer]): path = make_rpm.FindRpmbuild('') self.assertEqual(dummy, path)