def test_compare_mtimestamp_when_equal_ts(self, mock_path, mock_can_read): mock_can_read.return_value = True mock_path.isfile.return_value = True mock_path.getmtime.return_value = 4 result = utils.compare_mtimestamp('fpath1', 'fpath2') expected = 0 self.assertEqual(result, expected)
def test_compare_mtimestamp_when_unequal_ts_2(self, mock_path, mock_can_read): mock_can_read.return_value = True mock_path.isfile.return_value = True mock_path.getmtime.side_effect = [5, 4] result = utils.compare_mtimestamp('fpath1', 'fpath2') expected = 1 self.assertEqual(result, expected)
def _is_stats_file_older_than_data(cls, data_fpath, stats_fpath): if utils.compare_mtimestamp(data_fpath, stats_fpath) >= 0: return True return False