Esempio n. 1
0
 def test_symlink_candidate_is_in_transaction(self):
     self._add_to_db('o1', 'i1', 'i2')
     filemod_db.changed_files('o2', 'i1', 'i2', context='test')
     self._change_mtime('o1')
     self.assertEqual(set(['o1']),
                      filemod_db.changed_files('o1', 'i1', 'i2'))
     self.assertFalse(filemod_db.can_symlink_to('o2', 'o1'))
Esempio n. 2
0
 def test_symlinks_differ_in_whether_they_compute_crc(self):
     self._add_to_db('o1', 'i1', 'i2')
     # Start the update-transaction, as needed to call can_symlink_to().
     filemod_db.changed_files('o2', 'i1', 'i2',
                                             context='test',
                                             compute_crc=True)
     self.assertTrue(filemod_db.can_symlink_to('o2', 'o1'))
Esempio n. 3
0
 def test_symlink_to_self(self):
     self._add_to_db('o2', 'i1', 'i2')
     # We need to do this to force changed_files to return False.
     self._change_mtime('i1')
     filemod_db.changed_files('o2', 'i1', 'i2',
                                             context='test')
     self.assertFalse(filemod_db.can_symlink_to('o2', 'o2'))
Esempio n. 4
0
    def test_changed_files_destroys_symlinks(self):
        self._add_to_db('o1', 'i2', 'i3')

        self.assertEqual(set(['o_link']),
                         filemod_db.changed_files('o_link', 'i2', 'i3',
                                                  context='test'))
        os.symlink('o1', self._abspath('o_link'))
        self.assertTrue(os.path.islink(self._abspath('o_link')))
        self.assertTrue(os.path.samefile(self._abspath('o1'),
                                         self._abspath('o_link')))
        filemod_db.set_up_to_date('o_link')

        self._change_mtime('i2')
        del filemod_db._CURRENT_FILE_INFO['i2']
        actual = self._changed_files('o_link', 'i2', 'i3')
        self.assertEqual(set(['i2']), actual)
        filemod_db.set_up_to_date('o_link')
        self.assertFalse(os.path.islink(self._abspath('o_link')))
Esempio n. 5
0
 def _changed_files(self, outfile_name, *infile_names, **kwargs):
     kwargs.setdefault('context', 'test')
     return filemod_db.changed_files(outfile_name, *infile_names, **kwargs)
Esempio n. 6
0
 def test_infile_has_changed(self):
     self._add_to_db('o1', 'i1', 'i2')
     self._change_mtime('i1')
     filemod_db.changed_files('o2', 'i1', 'i2', context='test')
     self.assertFalse(filemod_db.can_symlink_to('o2', 'o1'))
Esempio n. 7
0
 def test_infile_is_symlink(self):
     self._add_to_db('o1', 'l1', 'l22')
     filemod_db.changed_files('o2', 'i1', 'i2', context='test')
     self.assertTrue(filemod_db.can_symlink_to('o2', 'o1'))
Esempio n. 8
0
 def test_different_input(self):
     self._add_to_db('o1', 'i1', 'i2', 'i3')
     filemod_db.changed_files('o2', 'i1', 'i2', context='test')
     self.assertFalse(filemod_db.can_symlink_to('o2', 'o1'))
Esempio n. 9
0
 def test_same_input(self):
     self._add_to_db('o1', 'i1', 'i2')
     # Start the update-transaction, as needed to call can_symlink_to().
     filemod_db.changed_files('o2', 'i1', 'i2', context='test')
     self.assertTrue(filemod_db.can_symlink_to('o2', 'o1'))