def _get_last_local_logs(root_log): if os.path.isdir(root_log): all_log_paths = [ os.path.join(root_log, n) for n in os.listdir(root_log) ] non_sym_paths = [p for p in all_log_paths if not os.path.islink(p)] if non_sym_paths: return utils.last_modified_file(non_sym_paths) return None
def test_last_modified_file(self, getmtime): getmtime.side_effect = [9.01, 200.0, 300.0, 5000.0] expected_last_mod_file = MOCK_FILES[-1] self.assertEqual(expected_last_mod_file, utils.last_modified_file(MOCK_FILES))