From: Theo Buehler Subject: Re: NEW: textproc/py-icecream To: ports Date: Mon, 2 Dec 2024 12:59:08 +0100 On Mon, Dec 02, 2024 at 11:47:30AM +0000, Stuart Henderson wrote: > Adding this will allow enabling tests in py-paramiko. (All but one pass). > OK? ok tb I've got two failing tests here, couldn't spot the immediate reason: FAILED tests/test_icecream.py::TestIceCream::testEnableDisable - AssertionErr... FAILED tests/test_icecream.py::TestIceCream::testSingledispatchArgumentToString ============================= test session starts ============================== platform openbsd7 -- Python 3.11.10, pytest-8.2.0, pluggy-1.5.0 rootdir: /usr/ports/pobj/py-icecream-2.1.3-python3/icecream-2.1.3 plugins: hypothesis-6.47.1 collected 35 items tests/test_icecream.py ..........F.....................F.. [100%] =================================== FAILURES =================================== ________________________ TestIceCream.testEnableDisable ________________________ self = def testEnableDisable(self): with disableColoring(), captureStandardStreams() as (out, err): assert ic(a) == 1 assert ic.enabled ic.disable() assert not ic.enabled assert ic(b) == 2 ic.enable() assert ic.enabled assert ic(c) == 3 pairs = parseOutputIntoPairs(out, err, 2) > assert pairs == [[('a', '1')], [('c', '3')]] E AssertionError: assert [[('REPL (e.g...ion?', None)]] == [[('a', '1')], [('c', '3')]] E E At index 0 diff: [('REPL (e.g. from the command line), a frozen application (e.g. packaged with PyInstaller), or did the underlying source code change during execution?', None)] != [('a', '1')] E Use -v to get more diff tests/test_icecream.py:380: AssertionError _______________ TestIceCream.testSingledispatchArgumentToString ________________ self = def testSingledispatchArgumentToString(self): def argumentToString_tuple(obj): return "Dispatching tuple!" # Unsupport Python2 if "singledispatch" not in dir(functools): for attr in ("register", "unregister"): with self.assertRaises(NotImplementedError): getattr(argumentToString, attr)( tuple, argumentToString_tuple ) return # Prepare input and output x = (1, 2) default_output = ic.format(x) # Register argumentToString.register(tuple, argumentToString_tuple) assert tuple in argumentToString.registry > assert str.endswith(ic.format(x), argumentToString_tuple(x)) tests/test_icecream.py:413: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ icecream/icecream.py:225: in format out = self._format(callFrame, *args) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = callFrame = args = ((1, 2),), prefix = 'ic| ', callNode = None def _format(self, callFrame, *args): prefix = callOrValue(self.prefix) callNode = Source.executing(callFrame).node if callNode is None: > raise NoSourceAvailableError() E icecream.icecream.NoSourceAvailableError icecream/icecream.py:233: NoSourceAvailableError =============================== warnings summary =============================== tests/test_icecream.py::TestIceCream::testMultilineContainerArgs /usr/ports/pobj/py-icecream-2.1.3-python3/icecream-2.1.3/tests/test_icecream.py:573: DeprecationWarning: Please use assertRegex instead. self.assertRegexpMatches( -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED tests/test_icecream.py::TestIceCream::testEnableDisable - AssertionErr... FAILED tests/test_icecream.py::TestIceCream::testSingledispatchArgumentToString =================== 2 failed, 33 passed, 1 warning in 0.30s ==================== *** Error 1 in . (/usr/ports/lang/python/python.port.mk:371 'do-test': @ cd /usr/ports/pobj/py-icecream-2.1.3-python3/icecream-2.1.3 && /usr...)