Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: test_malformed_docinfo fails with spectacular INTERNALERROR #1423

Open
3 tasks done
mcepl opened this issue Nov 6, 2024 · 3 comments
Open
3 tasks done

[Bug]: test_malformed_docinfo fails with spectacular INTERNALERROR #1423

mcepl opened this issue Nov 6, 2024 · 3 comments
Assignees
Labels
third party issue Problem with a third party dependency

Comments

@mcepl
Copy link

mcepl commented Nov 6, 2024

What were you trying to do?

In the end of the run of the test suite (while packaging OCRmyPDF for openSUSE/Factory) I see this:

[   30s] INTERNALERROR> def worker_internal_error(
[   30s] INTERNALERROR>         self, node: WorkerController, formatted_error: str
[   30s] INTERNALERROR>     ) -> None:
[   30s] INTERNALERROR>         """
[   30s] INTERNALERROR>         pytest_internalerror() was called on the worker.
[   30s] INTERNALERROR>     
[   30s] INTERNALERROR>         pytest_internalerror() arguments are an excinfo and an excrepr, which can't
[   30s] INTERNALERROR>         be serialized, so we go with a poor man's solution of raising an exception
[   30s] INTERNALERROR>         here ourselves using the formatted message.
[   30s] INTERNALERROR>         """
[   30s] INTERNALERROR>         self._active_nodes.remove(node)
[   30s] INTERNALERROR>         try:
[   30s] INTERNALERROR> >           assert False, formatted_error
[   30s] INTERNALERROR> E           AssertionError: Traceback (most recent call last):
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 283, in wrap_session
[   30s] INTERNALERROR> E                 session.exitstatus = doit(config, session) or 0
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 337, in _main
[   30s] INTERNALERROR> E                 config.hook.pytest_runtestloop(session=session)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
[   30s] INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
[   30s] INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
[   30s] INTERNALERROR> E                 raise exception.with_traceback(exception.__traceback__)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   30s] INTERNALERROR> E                 teardown.throw(exception)  # type: ignore[union-attr]
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/logging.py", line 803, in pytest_runtestloop
[   30s] INTERNALERROR> E                 return (yield)  # Run all the tests.
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   30s] INTERNALERROR> E                 teardown.throw(exception)  # type: ignore[union-attr]
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/terminal.py", line 673, in pytest_runtestloop
[   30s] INTERNALERROR> E                 result = yield
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
[   30s] INTERNALERROR> E                 res = hook_impl.function(*args)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/xdist/remote.py", line 174, in pytest_runtestloop
[   30s] INTERNALERROR> E                 self.run_one_test()
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/xdist/remote.py", line 195, in run_one_test
[   30s] INTERNALERROR> E                 self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
[   30s] INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
[   30s] INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
[   30s] INTERNALERROR> E                 raise exception.with_traceback(exception.__traceback__)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   30s] INTERNALERROR> E                 teardown.throw(exception)  # type: ignore[union-attr]
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/warnings.py", line 112, in pytest_runtest_protocol
[   30s] INTERNALERROR> E                 return (yield)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   30s] INTERNALERROR> E                 teardown.throw(exception)  # type: ignore[union-attr]
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/assertion/__init__.py", line 176, in pytest_runtest_protocol
[   30s] INTERNALERROR> E                 return (yield)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   30s] INTERNALERROR> E                 teardown.throw(exception)  # type: ignore[union-attr]
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/unittest.py", line 429, in pytest_runtest_protocol
[   30s] INTERNALERROR> E                 res = yield
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   30s] INTERNALERROR> E                 teardown.throw(exception)  # type: ignore[union-attr]
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/faulthandler.py", line 88, in pytest_runtest_protocol
[   30s] INTERNALERROR> E                 return (yield)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
[   30s] INTERNALERROR> E                 res = hook_impl.function(*args)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 113, in pytest_runtest_protocol
[   30s] INTERNALERROR> E                 runtestprotocol(item, nextitem=nextitem)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 132, in runtestprotocol
[   30s] INTERNALERROR> E                 reports.append(call_and_report(item, "call", log))
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 246, in call_and_report
[   30s] INTERNALERROR> E                 ihook.pytest_runtest_logreport(report=report)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
[   30s] INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
[   30s] INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
[   30s] INTERNALERROR> E                 raise exception.with_traceback(exception.__traceback__)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
[   30s] INTERNALERROR> E                 res = hook_impl.function(*args)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/terminal.py", line 635, in pytest_runtest_logreport
[   30s] INTERNALERROR> E                 reason = _get_raw_skip_reason(rep)
[   30s] INTERNALERROR> E               File "/usr/lib/python3.10/site-packages/_pytest/terminal.py", line 1566, in _get_raw_skip_reason
[   30s] INTERNALERROR> E                 if reason.startswith("reason: "):
[   30s] INTERNALERROR> E             AttributeError: 'tuple' object has no attribute 'startswith'
[   30s] INTERNALERROR> E           assert False
[   30s] INTERNALERROR> 
[   30s] INTERNALERROR> /usr/lib/python3.10/site-packages/xdist/dsession.py:232: AssertionError
[   30s] INTERNALERROR> Traceback (most recent call last):
[   30s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 283, in wrap_session
[   30s] INTERNALERROR>     session.exitstatus = doit(config, session) or 0
[   30s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 337, in _main
[   30s] INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
[   30s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
[   30s] INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
[   38s] INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
[   38s] INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   38s] INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/logging.py", line 803, in pytest_runtestloop
[   38s] INTERNALERROR>     return (yield)  # Run all the tests.
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
[   38s] INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/terminal.py", line 673, in pytest_runtestloop
[   38s] INTERNALERROR>     result = yield
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
[   38s] INTERNALERROR>     res = hook_impl.function(*args)
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/xdist/dsession.py", line 138, in pytest_runtestloop
[   38s] INTERNALERROR>     self.loop_once()
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/xdist/dsession.py", line 163, in loop_once
[   38s] INTERNALERROR>     call(**kwargs)
[   38s] INTERNALERROR>   File "/usr/lib/python3.10/site-packages/xdist/dsession.py", line 217, in worker_workerfinished
[   38s] INTERNALERROR>     assert not crashitem, (crashitem, node)
[   38s] INTERNALERROR> AssertionError: ('tests/test_metadata.py::test_malformed_docinfo', <WorkerController gw11>)
[   38s] INTERNALERROR> assert not 'tests/test_metadata.py::test_malformed_docinfo'
[   38s] 
[   38s] ================== 71 passed, 13 skipped, 2 xfailed in 14.91s ==================

Where are you installing/running from?

source build

OCRmyPDF version

16.6.0

What operating system are you working on?

Linux

Operating system details and version

openSUSE/Factory (development rolling distro)

Simple sanity checks

  • Operating system is currently supported by its vendor (not end of life)
  • Python version is compatible with OCRmyPDF
  • This issue is not about a specific input file

Relevant log output

No response

@mcepl mcepl added the triage Issue needs triage label Nov 6, 2024
@mcepl
Copy link
Author

mcepl commented Nov 6, 2024

Complete build log with all packages used and steps taken to reproduce.

@jbarlow83
Copy link
Collaborator

Try changing the build settings to run pytest-3.10 -n0 which will disable distributing the test to multiple workers with xdist. Alternatively, remove the package pytest-xdist. Then see if the error is reproducible then. I suspect the issue has to do with pytest-xdist -- perhaps there is a breaking upgrade or something of that nature.

I do appreciate getting the full build log but I'm still not sure how I would go about reproducing this and you're probably able to do more easily.

@jbarlow83 jbarlow83 added third party issue Problem with a third party dependency and removed triage Issue needs triage labels Nov 6, 2024
@mcepl
Copy link
Author

mcepl commented Nov 6, 2024

Yes, switching of parallel testing works around the problem.

No, it doesn’t. Even when I switched off parallelization and test coverage (useless for the distribution packaging) and uninstall particular supporting packages (coverage, pytest-cov, pytest-xdist), the test suite still fails until I skip test_malformed_docinfo test.

# Switch off parallelization of testing in the config file
# and getting coverage for our tests (useless for packaging)
sed -i -e '/addopts = "-n auto"/d' \
       -e '/^\[tool.coverage\./,/^[[:blank:]]*$/d' \
    pyproject.toml

I do appreciate getting the full build log but I'm still not sure how I would go about reproducing this and you're probably able to do more easily.

I absolutely didn’t mean like I wouldn’t like to do testing. Just trying to provide you with as much information as possible (and to preserve it for future).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
third party issue Problem with a third party dependency
Projects
None yet
Development

No branches or pull requests

2 participants