• Kirill Smelkov's avatar
    golang: tests: Fix Pytest integration wrt python3-dbg · a1ac2a45
    Kirill Smelkov authored
    There, with pytest 6.0.x, pytest emits its internal deprecation warning
    (the usage of deprecated attribute is inside pytest):
    
        .../_pytest/compat.py:340: PytestDeprecationWarning: The TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk.
        See https://docs.pytest.org/en/stable/deprecations.html#terminalreporter-writer for more information.
          return getattr(object, name, default)
    
    Which leads to test_defer_excchain_dump_pytest failure since this test
    verifies stderr to be empty:
    
            def test_defer_excchain_dump_pytest():
                tbok = readfile(dir_testprog + "/golang_test_defer_excchain.txt-pytest")
                retcode, stdout, stderr = _pyrun(["-m", "pytest", "-o", "python_functions=main",
                                            "--tb=short", "golang_test_defer_excchain.py"],
                                            cwd=dir_testprog, stdout=PIPE, stderr=PIPE)
                assert retcode != 0, (stdout, stderr)
        >       assert stderr == b""
        E       AssertionError: assert b'/home/kirr/...e, default)\n' == b''
        E         Full diff:
        E         - b''
        E         + (
        E         +  b'/home/kirr/src/tools/go/py3dbg.venv/lib/python3.8/site-packages/_pytest/comp'
        E         +  b'at.py:340: PytestDeprecationWarning: The TerminalReporter.writer attribute i'
        E         +  b's deprecated, use TerminalReporter._tw instead at your own risk.\nSee htt'
        E         +  b'ps://docs.pytest.org/en/stable/deprecations.html#terminalreporter-writer for'...
        E
        E         ...Full output truncated (3 lines hidden), use '-vv' to show
    
    -> Fix it by not letting spawned pytest to emit deprecation warnings in that test.
    a1ac2a45
golang_test.py 53.9 KB