def test_package_install(self): '''package installation/removal This will just do some very shallow tests if this is not run as root. ''' # test package; this is most likely not installed yet (test suite will # abort if it is) test_package = 'lrzsz' # use real OSLib here, not test suite's fake implementation o = OSLib() self.assertRaises(ValueError, o.install_package, 'nonexisting', None) # this should not crash, since it is not installed o.remove_package('nonexisting', None) if os.getuid() != 0: return self.failIf(o.package_installed(test_package), '%s must not be installed for this test' % test_package) # test without progress reporting o.install_package(test_package, None) self.assert_(o.package_installed(test_package)) o.remove_package(test_package, None) self.failIf(o.package_installed(test_package))