Beispiel #1
0
 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.')
Beispiel #2
0
 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.')
Beispiel #3
0
 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.')
Beispiel #4
0
 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.")
Beispiel #5
0
 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"]))
Beispiel #6
0
 def test_delete_invalid_file(self):
     self.assertFalse(delete_files(self.log_printer, ["non_existant_file"]))
Beispiel #7
0
 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')))
Beispiel #13
0
 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']))
Beispiel #14
0
 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')))