~elementary-os/ubuntu-package-imports/unattended-upgrades-bionic

« back to all changes in this revision

Viewing changes to test/test_remove_unused.py

  • Committer: RabbitBot
  • Date: 2018-03-09 04:45:54 UTC
  • Revision ID: rabbitbot@elementary.io-20180309044554-dbgn5pgr5fbpmi04
updated to version 1.0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
 
16
16
class MockOptions(object):
17
 
    debug = False
 
17
    debug = True
18
18
    verbose = False
19
19
    download_only = False
20
20
    dry_run = False
101
101
            options, rootdir="./root.unused-deps")
102
102
        with open(self.log) as f:
103
103
            # both the new and the old unused dependency are removed
104
 
            needle = "Packages that are auto removed: "\
105
 
                     "'old-unused-dependency test-package-dependency'"
 
104
            needle = "Packages that were successfully auto-removed: "\
 
105
                     "old-unused-dependency test-package-dependency"
106
106
            haystack = f.read()
107
107
            self.assertTrue(needle in haystack,
108
108
                            "Can not find '%s' in '%s'" % (needle, haystack))
109
109
 
110
110
    def test_remove_unused_dependencies_new_unused_only(self):
 
111
        apt.apt_pkg.config.set("APT::VersionedKernelPackages::", "linux-image")
 
112
        apt.apt_pkg.config.set("APT::VersionedKernelPackages::", ".*-modules")
 
113
        apt.apt_pkg.config.set("APT::VersionedKernelPackages::",
 
114
                               "linux-headers")
111
115
        apt_conf = os.path.join(self.rootdir, "etc", "apt", "apt.conf")
112
116
        with open(apt_conf, "w") as fp:
113
117
            fp.write("""
124
128
            options, rootdir="./root.unused-deps")
125
129
        with open(self.log) as f:
126
130
            # ensure its only exactly one package that is removed
127
 
            needle = "Packages that are auto removed: "\
128
 
                     "'test-package-dependency'"
 
131
            needle = "Packages that were successfully auto-removed: "\
 
132
                     "test-package-dependency"
129
133
            haystack = f.read()
130
134
            self.assertTrue(needle in haystack,
131
135
                            "Can not find '%s' in '%s'" % (needle, haystack))