pydiverse / pydiverse.pipedag

A data pipeline orchestration library for rapid iterative development with automatic cache invalidation allowing users to focus writing their tasks in pandas, polars, sqlalchemy, ibis, and alike.
https://pydiversepipedag.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
15 stars 2 forks source link

Fix pytest assert enrichment problem when running pytest with `--workers` option #215

Open windiana42 opened 1 month ago

windiana42 commented 1 month ago

This is a stack trace that illustrates the problem:

test_run_group_node.py:220: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../.pixi/envs/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:492: in _call_reprcompare
    custom = util._reprcompare(ops[i], each_obj[i], each_obj[i + 1])
../.pixi/envs/py312/lib/python3.12/site-packages/_pytest/assertion/__init__.py:151: in callbinrepr
    hook_result = ihook.pytest_assertrepr_compare(
../.pixi/envs/py312/lib/python3.12/site-packages/pluggy/_hooks.py:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
../.pixi/envs/py312/lib/python3.12/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
../.pixi/envs/py312/lib/python3.12/site-packages/_pytest/assertion/__init__.py:192: in pytest_assertrepr_compare
    return util.assertrepr_compare(config=config, op=op, left=left, right=right)
../.pixi/envs/py312/lib/python3.12/site-packages/_pytest/assertion/util.py:198: in assertrepr_compare
    highlighter = config.get_terminal_writer()._highlight
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.config.Config object at 0x101f60c50>

    def get_terminal_writer(self) -> TerminalWriter:
        terminalreporter: Optional[TerminalReporter] = self.pluginmanager.get_plugin(
            "terminalreporter"
        )
>       assert terminalreporter is not None
E       AssertionError

../.pixi/envs/py312/lib/python3.12/site-packages/_pytest/config/__init__.py:1145: AssertionError

An attempt to fix this issue had to be reverted since it prevented tests from actually running: https://github.com/pydiverse/pydiverse.pipedag/pull/207/commits/d65de1bdcb74d4b25788f98c145777d42e8befee