Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unit tests fail with "AttributeError: 'TesseractOcrModel' object has no attribute 'reader'" #3324

@booxter

Description

@booxter

https://github.com/instructlab/instructlab/actions/runs/14734963356/job/41358694626?pr=3323

 _______________________ test_convert_pdf_from_directory ________________________
  
  cls = <class '_pytest.runner.CallInfo'>
  func = <function call_and_report.<locals>.<lambda> at 0x7fbcb5ef98a0>
  when = 'call'
  reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
  
      @classmethod
      def from_call(
          cls,
          func: Callable[[], TResult],
          when: Literal["collect", "setup", "call", "teardown"],
          reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
      ) -> CallInfo[TResult]:
          """Call func, wrapping the result in a CallInfo.
      
          :param func:
              The function to call. Called without arguments.
          :type func: Callable[[], _pytest.runner.TResult]
          :param when:
              The phase in which the function is called.
          :param reraise:
              Exception or exceptions that shall propagate if raised by the
              function, instead of being wrapped in the CallInfo.
          """
          excinfo = None
          start = timing.time()
          precise_start = timing.perf_counter()
          try:
  >           result: TResult | None = func()
  
  .tox/py311-unitcov/lib/python3.11/site-packages/_pytest/runner.py:341: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  .tox/py311-unitcov/lib/python3.11/site-packages/_pytest/runner.py:242: in <lambda>
      lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
  .tox/py311-unitcov/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
      return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  .tox/py311-unitcov/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
      return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  .tox/py311-unitcov/lib/python3.11/site-packages/_pytest/threadexception.py:92: in pytest_runtest_call
      yield from thread_exception_runtest_hook()
  .tox/py311-unitcov/lib/python3.11/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
      yield
  .tox/py311-unitcov/lib/python3.11/site-packages/_pytest/unraisableexception.py:95: in pytest_runtest_call
      yield from unraisable_exception_runtest_hook()
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  
      def unraisable_exception_runtest_hook() -> Generator[None]:
          with catch_unraisable_exception() as cm:
              try:
                  yield
              finally:
                  if cm.unraisable:
                      if cm.unraisable.err_msg is not None:
                          err_msg = cm.unraisable.err_msg
                      else:
                          err_msg = "Exception ignored in"
                      msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
                      msg += "".join(
                          traceback.format_exception(
                              cm.unraisable.exc_type,
                              cm.unraisable.exc_value,
                              cm.unraisable.exc_traceback,
                          )
                      )
  >                   warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
  E                   pytest.PytestUnraisableExceptionWarning: Exception ignored in: <function TesseractOcrModel.__del__ at 0x7fbcb5473240>
  E                   
  E                   Traceback (most recent call last):
  E                     File "/home/runner/work/instructlab/instructlab/.tox/py311-unitcov/lib/python3.11/site-packages/docling/models/tesseract_ocr_model.py", line 106, in __del__
  E                       if self.reader is not None:
  E                          ^^^^^^^^^^^
  E                   AttributeError: 'TesseractOcrModel' object has no attribute 'reader'

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingci-failurePR has at least one CI failure

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions