• Kirill Smelkov's avatar
    golang: tests: Fix for Pytest ≥ 7.4 · 74a9838c
    Kirill Smelkov authored
    Pytest 7.4 changed format of output tracebacks. Similarly to IPython adding
    test support for later versions would add maintenance cost on pygolang
    side, but testing this is actually not needed, since we activate
    Pytest-related patch only on py2 and for py2 the latest pytest version
    is pytest 4.6.11.
    
    -> So simply skip this test if we see we have Pytest ≥ 7.4.
       Skip it only on py3 just in case.
    
    For the reference here is how diff in between running
    golang_test_defer_excchain.py on Pytest 7.3 and Pytest 7.4 looks:
    
        diff --git a/a b/b
        index 45680b99..47c29cea 100644
        --- a/a
        +++ b/b
        @@ -1,5 +1,5 @@
         ============================= test session starts ==============================
        -platform linux -- Python 3.12.2+, pytest-7.3.2, pluggy-1.4.0
        +platform linux -- Python 3.12.2+, pytest-7.4.0, pluggy-1.4.0
         rootdir: /home/kirr/src/tools/go/pygolang-master
         collected 1 item
    
        @@ -7,22 +7,16 @@ golang/testprog/golang_test_defer_excchain.py F                          [100%]
    
         =================================== FAILURES ===================================
         _____________________________________ main _____________________________________
        -golang/__init__.py:106: in _
        -    return f(*argv, **kw)
         golang/testprog/golang_test_defer_excchain.py:42: in main
             raise RuntimeError("err")
         E   RuntimeError: err
    
         During handling of the above exception, another exception occurred:
        -golang/__init__.py:183: in __exit__
        -    d()
         golang/testprog/golang_test_defer_excchain.py:31: in d1
             raise RuntimeError("d1: aaa")
         E   RuntimeError: d1: aaa
    
         During handling of the above exception, another exception occurred:
        -golang/__init__.py:183: in __exit__
        -    d()
         golang/testprog/golang_test_defer_excchain.py:33: in d2
             1/0
         E   ZeroDivisionError: division by zero
    
    /reviewed-by @jerome
    /reviewed-on !23
    74a9838c
golang_test.py 53.5 KB