~ubuntu-core-dev/unattended-upgrades/ubuntu

« back to all changes in this revision

Viewing changes to test/test_against_real_archive.py

  • Committer: Barry Warsaw
  • Date: 2012-06-19 20:19:36 UTC
  • mfrom: (277.1.5 unattended-upgrades)
  • mto: This revision was merged to the branch mainline in revision 288.
  • Revision ID: barry@python.org-20120619201936-vrpi8yxbbxzdr6qg
Merge Thomas's branch: Port to Python 3
- Additional fixes by Barry

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
 
1
#!/usr/bin/python3
2
2
 
3
3
import apt
4
4
import apt_pkg
42
42
        res = unattended_upgrade.main(options, os.path.abspath("./aptroot"))
43
43
        # check if the log file exists
44
44
        self.assertTrue(os.path.exists(logfile))
45
 
        log = open(logfile).read()
 
45
        with open(logfile) as fp:
 
46
            log = fp.read()
46
47
        # check that stuff worked
47
 
        self.assertFalse(" ERROR " in log)
 
48
        self.assertFalse(" ERROR " in log, log)
48
49
        # check if we actually have the expected ugprade in it
49
50
        self.assertTrue(
50
51
            re.search("INFO Packages that are upgraded:.*awstats", log))