cf discussion here https://github.com/pytest-dev/pytest/issues/162
I'm working on pytest-icdiff, trying to get it to print out well optimised messages for different terminal sizes, and it's hard. when i'm running tests using runpytest, and I _think_ in real life too, config.get_terminal_writer().fullwidth *inside the hook* is returning incorrect values: resizing the terminal i'm using to run the tests has no effect on the value i get from it. and when I use that value irl, real test output does not adjust correctly to the terminal size but calling py.io.TerminalWriter().fullwidth _outside_ the hook, eg at module level, _does_ give me readings that look right. but testing that is hard. intriguingly, if I do testdir.monkeypatch.setenv('COLUMNS', '50'), then the fullwdith *inside* the hook varies. but that's no use to me, since IRL that value doesn't work. so my question is: a) does anyone know of any good examples of assertrepr plugins that adjust dynamically to terminal width, and b) what's a good way of writing tests for that? here's the repo fwiw https://github.com/hjwp/pytest-icdiff/blob/master/tests/test_pytest_icdiff.py
_______________________________________________ pytest-dev mailing list pytest-dev@python.org https://mail.python.org/mailman/listinfo/pytest-dev