def setUp(self): self.aptroot = os.path.join(CURDIR, "aptroot-update-origin") self.dpkg_status = open("%s/var/lib/dpkg/status" % self.aptroot, "w") self.dpkg_status.flush() self.cache = MyCache(apt.progress.base.OpProgress(), rootdir=self.aptroot) self.cache._listsLock = 0 self.cache.update() self.cache.open()
def openCache(self): # open cache progress = apt.progress.text.OpProgress() if hasattr(self, "cache"): self.cache.open(progress) self.cache._initDepCache() else: self.cache = MyCache(progress) self.actiongroup = apt_pkg.ActionGroup(self.cache._depcache) # lock the cache self.cache.lock = True
def setUp(self): # mangle the arch real_arch = apt.apt_pkg.config.find("APT::Architecture") apt.apt_pkg.config.set("APT::Architecture", "amd64") self.addCleanup( lambda: apt.apt_pkg.config.set("APT::Architecture", real_arch)) self.aptroot = os.path.join(CURDIR, "aptroot-update-list-test") self.cache = MyCache(apt.progress.base.OpProgress(), rootdir=self.aptroot) self.cache.open() self.updates_list = UpdateList.UpdateList(parent=None)
def setUp(self): # Whenever a test will initialize apt_pkg, we must set the architecture # to amd64, because our various test files assume that. Even if this # test doesn't use those files, apt_pkg is only initialized once across # tests, so we must be consistent. real_arch = apt.apt_pkg.config.find("APT::Architecture") apt.apt_pkg.config.set("APT::Architecture", "amd64") self.addCleanup( lambda: apt.apt_pkg.config.set("APT::Architecture", real_arch)) aptroot = os.path.join(CURDIR, "aptroot-changelog") self.cache = MyCache(apt.progress.base.OpProgress(), rootdir=aptroot) self.cache.open()
def setUp(self, mock_desktop, mock_installed): # mangle the arch real_arch = apt.apt_pkg.config.find("APT::Architecture") apt.apt_pkg.config.set("APT::Architecture", "amd64") self.addCleanup( lambda: apt.apt_pkg.config.set("APT::Architecture", real_arch)) self.aptroot = os.path.join(CURDIR, "aptroot-grouping-test") self.cache = MyCache(apt.progress.base.OpProgress(), rootdir=self.aptroot) self.cache.open() mock_installed.__get__ = self.fake_installed_files mock_desktop.side_effect = self.fake_desktop self.updates_list = UpdateList.UpdateList(parent=None, dist='lucid') self.updates_list.update(self.cache)
def setUp(self): # Whenever a test will initialize apt_pkg, we must set the architecture # to amd64, because our various test files assume that. Even if this # test doesn't use those files, apt_pkg is only initialized once across # tests, so we must be consistent. real_arch = apt.apt_pkg.config.find("APT::Architecture") apt.apt_pkg.config.set("APT::Architecture", "amd64") self.addCleanup( lambda: apt.apt_pkg.config.set("APT::Architecture", real_arch)) # We don't need anything special, but since we modify architecture # above, we ought to point to an aptroot that matches the arch self.aptroot = os.path.join(CURDIR, "aptroot-cache-test") self.cache = MyCache(None, rootdir=self.aptroot) self.cache.open()
def setUp(self): # mangle the arch real_arch = apt.apt_pkg.config.find("APT::Architecture") apt.apt_pkg.config.set("APT::Architecture", "amd64") self.addCleanup( lambda: apt.apt_pkg.config.set("APT::Architecture", real_arch)) self.aptroot = os.path.join(CURDIR, "aptroot-update-origin") self.dpkg_status = open("%s/var/lib/dpkg/status" % self.aptroot, "w") self.dpkg_status.flush() self.cache = MyCache(apt.progress.base.OpProgress(), rootdir=self.aptroot) self.cache._listsLock = 0 self.cache.update() self.cache.open()