Skip to content

Commit

Permalink
tests:include assert for rmtree calling after exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jlmadurga committed Feb 22, 2018
1 parent 57bf33e commit 4405931
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_document_clipper_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,13 @@ def test_pdf_to_text_from_pdf_with_images_no_jpg(self):
self.document_clipper_pdf_reader.pdf_to_text(self._images_to_text_method_mocked())
self.assertEqual(1, len(self.document_clipper_pdf_reader._pdf_image_to_text_method.call_args_list))

def test_pdf_to_text_from_pdf_with_images_exception_raised(self):
@patch('shutil.rmtree')
def test_pdf_to_text_from_pdf_with_images_exception_raised(self, mock_rmtree):
self.pdf_file = open(PATH_TO_PDF_FILE_WITH_IMAGES)
self.document_clipper_pdf_reader = DocumentClipperPdfReader(self.pdf_file)
self.assertRaises(Exception, self.document_clipper_pdf_reader.pdf_to_text,
self._images_to_text_method_mocked_with_exception())
self.assertEqual(1, len(mock_rmtree.call_args_list))

@patch('os.remove')
def test_fix_pdf_ok(self, mock_os_remove):
Expand Down

0 comments on commit 4405931

Please sign in to comment.