def run(self): """ Runs indefinitely until it is asked to finish. Processes files from the 'input_queue' and supplies them to a 'ReferenceMaker' object. Once the ReferenceMaker is done, it stores the results in tuples (file, reference) to the output queue. """ log.debug("Running thread", extra={'threadname': self.getName()}) #@UndefinedVariable while not self.stop_event.isSet(): file = None if not self.in_queue.empty(): try: file = self.in_queue.get(False) except Queue.Empty: continue if file: log.debug("Processing file %s" % file) #@UndefinedVariable try: reference = ReferenceMaker().make_reference( file, self.target_format) self.out_queue.put(reference) except Exception, e: log.error( 'Unexpected exception while extracting reference' #@UndefinedVariable ' for file %s: %s' % (file, str(e))) self.out_queue.put(Extraction()) continue
class TestReferenceMaker(unittest.TestCase): def setUp(self): self.rm = ReferenceMaker() self.file = normpath(join(dirname(__file__), ('../../../../tests/' 'fixtures/extraction/article.pdf'))) def tearDown(self): pass def test_make_reference(self): references = self.rm.make_reference(self.file, ReferenceFormat.BIBTEX)
class TestReferenceMaker(unittest.TestCase): def setUp(self): self.rm = ReferenceMaker() self.file = normpath( join(dirname(__file__), ('../../../../tests/' 'fixtures/extraction/article.pdf'))) def tearDown(self): pass def test_make_reference(self): references = self.rm.make_reference(self.file, ReferenceFormat.BIBTEX)
def setUp(self): self.rm = ReferenceMaker() self.file = normpath(join(dirname(__file__), ('../../../../tests/' 'fixtures/extraction/article.pdf')))
def setUp(self): self.rm = ReferenceMaker() self.file = normpath( join(dirname(__file__), ('../../../../tests/' 'fixtures/extraction/article.pdf')))