~ubuntu-core-dev/ubuntu/xenial/ubuntu-release-upgrader/xenial

« back to all changes in this revision

Viewing changes to tests/test_xorg_fix_intrepid.py

  • Committer: Dimitri John Ledkov
  • Date: 2015-01-20 22:30:06 UTC
  • mto: This revision was merged to the branch mainline in revision 2859.
  • Revision ID: dimitri.j.ledkov@intel.com-20150120223006-ba30fbqtp4x2n0og
Fix resource warnings & logging.warn deprecation warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    def test_simple(self):
25
25
        shutil.copy(self.ORIG, self.NEW)
26
26
        replace_driver_from_xorg("fglrx", "ati", self.NEW)
27
 
        self.assertEqual(open(self.NEW).read(), open(self.ORIG).read())
 
27
        with open(self.NEW) as n, open(self.ORIG) as o:
 
28
            self.assertEqual(n.read(), o.read())
28
29
 
29
30
    def test_remove(self):
30
31
        shutil.copy(self.FGLRX, self.NEW)
31
 
        self.assertTrue("fglrx" in open(self.NEW).read())
 
32
        with open(self.NEW) as f:
 
33
            self.assertTrue("fglrx" in f.read())
32
34
        replace_driver_from_xorg("fglrx", "ati", self.NEW)
33
 
        self.assertFalse("fglrx" in open(self.NEW).read())
 
35
        with open(self.NEW) as f:
 
36
            self.assertFalse("fglrx" in f.read())
34
37
 
35
38
    def test_omment(self):
36
39
        shutil.copy(self.FGLRX, self.NEW)
37
40
        comment_out_driver_from_xorg("fglrx", self.NEW)
38
 
        for line in open(self.NEW):
 
41
        with open(self.NEW) as n:
 
42
            lines = n.readlines()
 
43
        for line in lines:
39
44
            if re.match('^#.*Driver.*fglrx', line):
40
45
                import logging
41
46
                logging.info("commented out line found")