~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_tree/test_get_file_mtime.py

  • Committer: Vincent Ladeuil
  • Date: 2017-01-17 13:48:10 UTC
  • mfrom: (6615.3.6 merges)
  • mto: This revision was merged to the branch mainline in revision 6620.
  • Revision ID: v.ladeuil+lp@free.fr-20170117134810-j9p3lidfy6pfyfsc
Merge 2.7, resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import time
20
20
 
 
21
from bzrlib import errors
 
22
 
21
23
from bzrlib.tests.per_tree import TestCaseWithTree
22
24
 
23
25
 
38
40
        # file, working trees return the on-disk time.
39
41
        mtime_file_id = tree.get_file_mtime(file_id='one-id')
40
42
        self.assertIsInstance(mtime_file_id, (float, int))
41
 
        self.failUnless(now - 5 < mtime_file_id < now + 5,
 
43
        self.assertTrue(now - 5 < mtime_file_id < now + 5,
42
44
                        'now: %f, mtime_file_id: %f' % (now, mtime_file_id ))
43
45
        mtime_path = tree.get_file_mtime(file_id='one-id', path='one')
44
46
        self.assertEqual(mtime_file_id, mtime_path)
 
47
 
 
48
    def test_nonexistant(self):
 
49
        tree = self.get_basic_tree()
 
50
        tree.lock_read()
 
51
        self.addCleanup(tree.unlock)
 
52
        self.assertRaises(errors.NoSuchId,
 
53
            tree.get_file_mtime, file_id='unexistant')