Skip to content

New test failures with Python 3.9.0a6 #7161

Closed
@hroncok

Description

@hroncok

After upgrading to Python 3.9.0a6, I see 2 new test failures, both in testing/code/test_source.py.

This is Fedora 32, CPython 3.9.0a6, with tox -e py39, master branch @ 80e5098.

$ .tox/py39/bin/pip list
Package          Version                
---------------- -----------------------
argcomplete      1.11.1                 
attrs            19.3.0                 
certifi          2020.4.5.1             
chardet          3.0.4                  
elementpath      1.4.4                  
hypothesis       5.10.5                 
idna             2.9                    
mock             4.0.2                  
more-itertools   8.2.0                  
nose             1.3.7                  
packaging        20.3                   
pip              19.3.1                 
pluggy           0.13.1                 
py               1.8.1                  
Pygments         2.6.1                  
pyparsing        2.4.7                  
pytest           5.4.1.dev171+g80e509840
requests         2.23.0                 
setuptools       41.6.0                 
six              1.14.0                 
sortedcontainers 2.1.0                  
urllib3          1.25.9                 
wcwidth          0.1.9                  
wheel            0.33.6                 
xmlschema        1.1.3       
  • a detailed description of the bug or suggestion
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible
$ tox -e py39 -- -k "test_syntaxerror_rerepresentation or test_getfslineno"
py39 inst-nodeps: .../pytest/.tox/.tmp/package/1/pytest-5.4.1.dev171+g80e509840.tar.gz
py39 installed: argcomplete==1.11.1,attrs==19.3.0,certifi==2020.4.5.1,chardet==3.0.4,elementpath==1.4.4,hypothesis==5.10.5,idna==2.9,mock==4.0.2,more-itertools==8.2.0,nose==1.3.7,packaging==20.3,pluggy==0.13.1,py==1.8.1,Pygments==2.6.1,pyparsing==2.4.7,pytest==5.0.2.dev41+g183750fa8,requests==2.23.0,six==1.14.0,sortedcontainers==2.1.0,urllib3==1.25.9,wcwidth==0.1.9,xmlschema==1.1.3
py39 run-test-pre: PYTHONHASHSEED='3233708815'
py39 run-test: commands[0] | pytest -k 'test_syntaxerror_rerepresentation or test_getfslineno'
============================= test session starts ==============================
platform linux -- Python 3.9.0a6, pytest-5.4.1.dev171+g80e509840, py-1.8.1, pluggy-0.13.1
cachedir: .tox/py39/.pytest_cache
rootdir: .../pytest, inifile: tox.ini, testpaths: testing
plugins: hypothesis-5.10.5
collected 2688 items / 2686 deselected / 2 selected

testing/code/test_source.py FF                                           [100%]

=================================== FAILURES ===================================
______________________ test_syntaxerror_rerepresentation _______________________

    def test_syntaxerror_rerepresentation() -> None:
        ex = pytest.raises(SyntaxError, _pytest._code.compile, "xyz xyz")
        assert ex is not None
        assert ex.value.lineno == 1
        assert ex.value.offset in {5, 7}  # cpython: 7, pypy3.6 7.1.1: 5
>       assert ex.value.text == "xyz xyz\n"
E       AssertionError: assert 'xyz xyz' == 'xyz xyz\n'
E         - xyz xyz
E         ?        -
E         + xyz xyz

testing/code/test_source.py:125: AssertionError
_______________________________ test_getfslineno _______________________________

    def test_getfslineno() -> None:
        def f(x) -> None:
            raise NotImplementedError()
    
        fspath, lineno = getfslineno(f)
    
        assert isinstance(fspath, py.path.local)
        assert fspath.basename == "test_source.py"
        assert lineno == f.__code__.co_firstlineno - 1  # see findsource
    
        class A:
            pass
    
        fspath, lineno = getfslineno(A)
    
        _, A_lineno = inspect.findsource(A)
        assert isinstance(fspath, py.path.local)
        assert fspath.basename == "test_source.py"
        assert lineno == A_lineno
    
        assert getfslineno(3) == ("", -1)
    
        class B:
            pass
    
        B.__name__ = "B2"
>       assert getfslineno(B)[1] == -1
E       assert 520 == -1

testing/code/test_source.py:525: AssertionError
=========================== short test summary info ============================
FAILED testing/code/test_source.py::test_syntaxerror_rerepresentation - Asser...
FAILED testing/code/test_source.py::test_getfslineno - assert 520 == -1
====================== 2 failed, 2686 deselected in 3.01s ======================
ERROR: InvocationError for command .../pytest/.tox/py39/bin/pytest -k 'test_syntaxerror_rerepresentation or test_getfslineno' (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py39: commands failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: selftestsa problem in the tests of pytest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions