/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Martin
  • Date: 2010-01-06 19:59:02 UTC
  • mto: (4934.1.9 2.1.0rc1-set-mtime)
  • mto: This revision was merged to the branch mainline in revision 4940.
  • Revision ID: gzlist@googlemail.com-20100106195902-vi1ckfsu2wurtt8v
Rearrange osutils.fset_mtime tests a little and make them robust on FAT filesystems

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
        self.addCleanup(self.wt.unlock)
144
144
        # Roll back the clock, so that we know everything is being set to the
145
145
        # exact time
146
 
        transform._creation_mtime = time.time() - 10.0
 
146
        transform._creation_mtime = creation_mtime = time.time() - 10.0
147
147
        transform.create_file('content-one',
148
148
                              transform.create_path('one', root))
149
149
        time.sleep(1) # *ugly*
154
154
        fo.close()
155
155
        fo, st2 = self.wt.get_file_with_stat(None, path='two', filtered=False)
156
156
        fo.close()
157
 
        # We only guarantee 1s resolution
158
 
        self.assertEqual(int(transform._creation_mtime), int(st1.st_mtime))
 
157
        # We only guarantee 2s resolution
 
158
        self.assertFalse(int((creation_mtime - st1.st_mtime) / 2),
 
159
            "%r != %r within two seconds" % (creation_mtime, st1.st_mtime))
159
160
        # But if we have more than that, all files should get the same result
160
161
        self.assertEqual(st1.st_mtime, st2.st_mtime)
161
162