~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_export.py

  • Committer: Martin
  • Date: 2010-04-14 00:11:32 UTC
  • mto: This revision was merged to the branch mainline in revision 5164.
  • Revision ID: gzlist@googlemail.com-20100414001132-6m1ru11mbfu87x6m
Fix os.utime test failures, three on FAT filesystems and one with readonly files

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
    def test_dir_export_files_per_file_timestamps(self):
103
103
        builder = self.make_branch_builder('source')
104
104
        builder.start_series()
 
105
        # Earliest allowable date on FAT32 filesystems is 1980-01-01
 
106
        a_time = time.mktime((1999, 12, 12, 0, 0, 0, 0, 0, 0))
 
107
        b_time = time.mktime((1980, 01, 01, 0, 0, 0, 0, 0, 0))
105
108
        builder.build_snapshot(None, None, [
106
109
            ('add', ('', 'root-id', 'directory', '')),
107
110
            ('add', ('a', 'a-id', 'file', 'content\n'))],
108
 
            timestamp=3423)
 
111
            timestamp=a_time)
109
112
        builder.build_snapshot(None, None, [
110
113
            ('add', ('b', 'b-id', 'file', 'content\n'))],
111
 
            timestamp=42)
 
114
            timestamp=b_time)
112
115
        builder.finish_series()
113
116
        b = builder.get_branch()
114
117
        b.lock_read()
116
119
        tree = b.basis_tree()
117
120
        export.export(tree, 'target', format='dir', per_file_timestamps=True)
118
121
        t = self.get_transport('target')
119
 
        st_a = t.stat('a')
120
 
        st_b = t.stat('b')
121
 
        self.assertEqual(42.0, st_b.st_mtime)
122
 
        self.assertEqual(3423.0, st_a.st_mtime)
 
122
        self.assertEqual(a_time, t.stat('a').st_mtime)
 
123
        self.assertEqual(b_time, t.stat('b').st_mtime)