~mvo/aptdaemon/fix-702217

« back to all changes in this revision

Viewing changes to tests/test_lock.py

  • Committer: Michael Vogt
  • Date: 2011-02-08 15:29:02 UTC
  • Revision ID: michael.vogt@ubuntu.com-20110208152902-rj26ouqbo5pe0jjw
tests/test_lock.py: make tests work when Dpkg::Post-Invoke has root only commands

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        self.dpkg_cmd = ["fakeroot", "dpkg", "--root", self.chroot.path,
57
57
                         "--log=%s/var/log/dpkg.log" % self.chroot.path,
58
58
                         "--install", pkg_path]
59
 
        self.inst_cmd = 'apt-get install silly-base -o "Dir"="%s" ' \
 
59
        self.inst_cmd = 'apt-get install silly-base ' \
 
60
                        '-o "Dir"="%s" ' \
60
61
                        '-o "Dir::state::status"="%s/var/lib/dpkg/status" ' \
61
62
                        '-o "Dir::Bin::Dpkg"="%s/dpkg-wrapper.sh" ' \
62
63
                        '-o "DPkg::Options::"="--root=%s" -y --force-yes' % \
65
66
        self.apt_cmd = 'apt-get update -o "Dir"="%s" -o "Dir::state::status="' \
66
67
                       '"%s/var/lib/dpkg/status"' % (self.chroot.path,
67
68
                                                     self.chroot.path)
68
 
        self.env={"PATH": "/sbin:/bin:/usr/bin:/usr/sbin"}
 
69
        # ensure to kill /etc/apt/apt.conf.d, otherwise stuff like
 
70
        # the (root only) Dpkg::Post-Invoke actions are run
 
71
        open("%s/etc/apt/apt.conf" % self.chroot.path, "w").write(
 
72
            'Dir::Etc::parts "/directory-does-not-exist";')
 
73
        self.env = {
 
74
            # override the default apt conf to kill off apt.conf.d includes
 
75
            "APT_CONFIG" : "%s/etc/apt/apt.conf" % self.chroot.path,
 
76
            # provide a path for dpkg
 
77
            "PATH" : "/sbin:/bin:/usr/bin:/usr/sbin",
 
78
            }
69
79
 
70
80
    def test_global_lock(self):
71
81
        """Check if the lock blocks dpkg and apt-get."""