question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New test failures with Python 3.9.0a6

See original GitHub issue

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 @ 80e509840813cb5da45fbe830718ea3707c02b25.

$ .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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
hroncokcommented, May 4, 2020

I think the first failure might be “fixed” by an rstrip call, however I haven’t really grasped the second one 😦

1reaction
nicoddemuscommented, May 4, 2020

Thanks @hroncok!

We will take a look at this once we can get some version of Python 3.9 running on CI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1831126 – python-testtools fails to build with Python 3.9
Bug 1831126 - python-testtools fails to build with Python 3.9: New SyntaxError messages break 2 tests. Summary: python-testtools fails to ...
Read more >
What's New In Python 3.9 — Python 3.11.1 documentation
More generally, try to run your tests in the Python Development Mode which helps to prepare your code to make it compatible with...
Read more >
pythoninfo collect_gdb() blows up when gdb fails to run
msg367641 ‑ (view) Author: Miro Hrončok (hroncok) * Date: 2020‑04‑29 11:36 msg367647 ‑ (view) Author: Miro Hrončok (hroncok) * Date: 2020‑04‑29 14:09 msg367654 ‑ (view)...
Read more >
Python Release Python 3.9.0a6
Python 3.9.0a6. Release Date: April 28, 2020. This is an early developer preview of Python 3.9. Python 3.9 is still in development.
Read more >
What's New In Python 3.10 — Python 3.11.1 documentation
This article explains the new features in Python 3.10, compared to 3.9. ... In a similar way, errors involving unclosed string literals (single...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found