def flush_cache(self): """ Flushes the cache and deletes the relevant file. """ self.data = {} delete_files(None, [self.project_dir]) logging.debug('The file cache was successfully flushed.')
def flush_cache(self): """ Flushes the cache and deletes the relevant file. """ self.data = {} delete_files(self.log_printer, [self.project_dir]) self.log_printer.debug('The file cache was successfully flushed.')
def flush_cache(self): """ Flushes the cache and deletes the relevant file. """ self.data = {} delete_files(self.log_printer, [self.project_dir]) self.log_printer.debug("The file cache was successfully flushed.")
def test_delete_permission_error(self, mock_os): with open(get_data_path(self.log_printer, "coala_test"), "w"): mock_os.remove.side_effect = OSError("Permission error") self.assertTrue( os.path.isfile(get_data_path(self.log_printer, "coala_test"))) self.assertFalse(delete_files(self.log_printer, ["coala_test"]))
def test_delete_invalid_file(self): self.assertFalse(delete_files(self.log_printer, ["non_existant_file"]))
def test_delete_files(self): pickle_dump(self.log_printer, "coala_test", {"answer": 42}) self.assertTrue(delete_files(self.log_printer, ["coala_test"])) self.assertFalse( os.path.isfile(get_data_path(self.log_printer, "coala_test")))
def test_delete_invalid_file(self): self.assertFalse(delete_files( self.log_printer, ["non_existant_file"]))
def test_delete_permission_error(self, mock_os): with open(get_data_path(self.log_printer, "coala_test"), "w"): mock_os.remove.side_effect = OSError("Permission error") self.assertTrue(os.path.isfile(get_data_path( self.log_printer, "coala_test"))) self.assertFalse(delete_files(self.log_printer, ["coala_test"]))
def test_delete_files(self): pickle_dump(self.log_printer, "coala_test", {"answer": 42}) self.assertTrue(delete_files( self.log_printer, ["coala_test"])) self.assertFalse(os.path.isfile(get_data_path( self.log_printer, "coala_test")))
def test_delete_permission_error(self, mock_os): with open(get_data_path(self.log_printer, 'coala_test'), 'w'): mock_os.remove.side_effect = OSError('Permission error') self.assertTrue(os.path.isfile(get_data_path( self.log_printer, 'coala_test'))) self.assertFalse(delete_files(self.log_printer, ['coala_test']))
def test_delete_files(self): pickle_dump(self.log_printer, 'coala_test', {'answer': 42}) self.assertTrue(delete_files( self.log_printer, ['coala_test'])) self.assertFalse(os.path.isfile(get_data_path( self.log_printer, 'coala_test')))
def test_delete_permission_error(self, mock_os): with open(get_data_path(self.log_printer, 'coala_test'), 'w'): mock_os.remove.side_effect = OSError('Permission error') self.assertTrue( os.path.isfile(get_data_path(self.log_printer, 'coala_test'))) self.assertFalse(delete_files(self.log_printer, ['coala_test']))
def test_delete_files(self): pickle_dump(self.log_printer, 'coala_test', {'answer': 42}) self.assertTrue(delete_files(self.log_printer, ['coala_test'])) self.assertFalse( os.path.isfile(get_data_path(self.log_printer, 'coala_test')))