Bug 971265 - Pre: Don't write file in test_util.py. r=gps
authorNick Alexander <nalexander@mozilla.com>
Thu, 13 Feb 2014 09:09:07 -0800
changeset 168597 7812cc0ea7954ab1ab7ec7ab73a38ea55693bebf
parent 168596 7e59dbb63fdf98697e9ef5a5e635f905cdc66fd6
child 168598 fa1585a40c130a1b37d4871d22f2cf31c545a579
push id26210
push userkwierso@gmail.com
push dateFri, 14 Feb 2014 00:52:58 +0000
treeherdermozilla-central@0f18070eb5d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs971265
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 971265 - Pre: Don't write file in test_util.py. r=gps
python/mozbuild/mozbuild/test/test_util.py
--- a/python/mozbuild/mozbuild/test/test_util.py
+++ b/python/mozbuild/mozbuild/test/test_util.py
@@ -109,20 +109,21 @@ class TestFileAvoidWrite(unittest.TestCa
             # same content as what already is in the file
             faw = FileAvoidWrite('file')
             faw.write('content')
             self.assertEqual(faw.close(), (True, False))
 
     def test_diff_not_default(self):
         """Diffs are not produced by default."""
 
-        faw = FileAvoidWrite('doesnotexist')
-        faw.write('dummy')
-        faw.close()
-        self.assertIsNone(faw.diff)
+        with MockedOpen({'file': 'old'}):
+            faw = FileAvoidWrite('file')
+            faw.write('dummy')
+            faw.close()
+            self.assertIsNone(faw.diff)
 
     def test_diff_update(self):
         """Diffs are produced on file update."""
 
         with MockedOpen({'file': 'old'}):
             faw = FileAvoidWrite('file', capture_diff=True)
             faw.write('new')
             faw.close()