Commit 4fefae90 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: test: Fix for Pytest < 7

In 74a9838c (golang: tests: Fix for Pytest ≥ 7.4) I fixed
test_defer_excchain_dump_pytest for Pytest ≥ 7.4 but missed that
pytest.version_tuple is not available for Pytest < 7.0(*) which started to
lead to pygolang test failures on py3 under SlapOS becuase there we
are still using pytest 4.6.11 :

    _______________________ test_defer_excchain_dump_pytest ________________________

        def test_defer_excchain_dump_pytest():
            # pytest 7.4 also changed traceback output format
            # similarly to ipython we do not need to test it becase we activate
            # pytest-related patch only on py2 for which latest pytest version is 4.6.11 .
            import pytest
    >       if six.PY3 and pytest.version_tuple >= (7,4):
    E       AttributeError: module 'pytest' has no attribute 'version_tuple'

https://stack.nexedi.com/test_result_module/20240920-666C5CF1/3

-> Fix that by checking pytest.version_tuple more carefully.

(*) see https://docs.pytest.org/en/stable/reference/reference.html#pytest-version-tuple

/reviewed-by @jerome
/reviewed-on !29
parent 30f06b4a
Pipeline #36963 passed with stage
in 0 seconds
......@@ -1697,7 +1697,7 @@ def test_defer_excchain_dump_pytest():
# similarly to ipython we do not need to test it becase we activate
# pytest-related patch only on py2 for which latest pytest version is 4.6.11 .
import pytest
if six.PY3 and pytest.version_tuple >= (7,4):
if six.PY3 and getattr(pytest, 'version_tuple', (0,)) >= (7,4):
skip("pytest is patched only on py2; pytest7.4 changed traceback format")
tbok = readfile(dir_testprog + "/golang_test_defer_excchain.txt-pytest")
retcode, stdout, stderr = _pyrun([
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment