Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

tests fail on python 3.8 #8

Closed
eli-schwartz opened this issue Nov 10, 2019 · 0 comments · Fixed by #9
Closed

tests fail on python 3.8 #8

eli-schwartz opened this issue Nov 10, 2019 · 0 comments · Fixed by #9

Comments

@eli-schwartz
Copy link
Contributor

==> Starting check()...
============================= test session starts ==============================
platform linux -- Python 3.8.0, pytest-5.2.2, py-1.8.0, pluggy-0.13.0
rootdir: /build/python-dephell-discover/src/dephell_discover-0.2.8
collected 27 items

tests/test_metainfo.py FFFFF.                                            [ 22%]
tests/test_root.py .....................                                 [100%]

=================================== FAILURES ===================================
__________________ test_vars[__license__ = "MIT"-license-MIT] __________________

tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/test_vars___license______MIT__0')
content = '__license__ = "MIT"', name = 'license', expected = 'MIT'

    @pytest.mark.parametrize('content, name, expected', [
        ('__license__ = "MIT"', 'license', 'MIT'),
    
        ('__version__ = "0.2.7"', 'version', '0.2.7'),
        ('__version__ = ("0", "2", "7")', 'version', '0.2.7'),
        # ('__version__ = (0, 2, 7)', 'version', '0.2.7'),
    
        ('__author__ = "Gram"', 'authors', ['Gram']),
        ('__authors__ = ["Gram"]', 'authors', ['Gram']),
    
    ])
    def test_vars(tmp_path: Path, content: str, name: str, expected):
        path = tmp_path / 'lol.py'
        path.write_text(content)
        info = MetaInfo.parse(paths=[path])
>       assert getattr(info, name) == expected
E       AssertionError: assert None == 'MIT'
E        +  where None = getattr(MetaInfo(lines=[]), 'license')

tests/test_metainfo.py:23: AssertionError
________________ test_vars[__version__ = "0.2.7"-version-0.2.7] ________________

tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/test_vars___version______0_2_70')
content = '__version__ = "0.2.7"', name = 'version', expected = '0.2.7'

    @pytest.mark.parametrize('content, name, expected', [
        ('__license__ = "MIT"', 'license', 'MIT'),
    
        ('__version__ = "0.2.7"', 'version', '0.2.7'),
        ('__version__ = ("0", "2", "7")', 'version', '0.2.7'),
        # ('__version__ = (0, 2, 7)', 'version', '0.2.7'),
    
        ('__author__ = "Gram"', 'authors', ['Gram']),
        ('__authors__ = ["Gram"]', 'authors', ['Gram']),
    
    ])
    def test_vars(tmp_path: Path, content: str, name: str, expected):
        path = tmp_path / 'lol.py'
        path.write_text(content)
        info = MetaInfo.parse(paths=[path])
>       assert getattr(info, name) == expected
E       AssertionError: assert None == '0.2.7'
E        +  where None = getattr(MetaInfo(lines=[]), 'version')

tests/test_metainfo.py:23: AssertionError
____________ test_vars[__version__ = ("0", "2", "7")-version-0.2.7] ____________

tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/test_vars___version_______0___0')
content = '__version__ = ("0", "2", "7")', name = 'version', expected = '0.2.7'

    @pytest.mark.parametrize('content, name, expected', [
        ('__license__ = "MIT"', 'license', 'MIT'),
    
        ('__version__ = "0.2.7"', 'version', '0.2.7'),
        ('__version__ = ("0", "2", "7")', 'version', '0.2.7'),
        # ('__version__ = (0, 2, 7)', 'version', '0.2.7'),
    
        ('__author__ = "Gram"', 'authors', ['Gram']),
        ('__authors__ = ["Gram"]', 'authors', ['Gram']),
    
    ])
    def test_vars(tmp_path: Path, content: str, name: str, expected):
        path = tmp_path / 'lol.py'
        path.write_text(content)
        info = MetaInfo.parse(paths=[path])
>       assert getattr(info, name) == expected
E       AssertionError: assert None == '0.2.7'
E        +  where None = getattr(MetaInfo(lines=[]), 'version')

tests/test_metainfo.py:23: AssertionError
_______________ test_vars[__author__ = "Gram"-authors-expected3] _______________

tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/test_vars___author______Gram__0')
content = '__author__ = "Gram"', name = 'authors', expected = ['Gram']

    @pytest.mark.parametrize('content, name, expected', [
        ('__license__ = "MIT"', 'license', 'MIT'),
    
        ('__version__ = "0.2.7"', 'version', '0.2.7'),
        ('__version__ = ("0", "2", "7")', 'version', '0.2.7'),
        # ('__version__ = (0, 2, 7)', 'version', '0.2.7'),
    
        ('__author__ = "Gram"', 'authors', ['Gram']),
        ('__authors__ = ["Gram"]', 'authors', ['Gram']),
    
    ])
    def test_vars(tmp_path: Path, content: str, name: str, expected):
        path = tmp_path / 'lol.py'
        path.write_text(content)
        info = MetaInfo.parse(paths=[path])
>       assert getattr(info, name) == expected
E       AssertionError: assert [] == ['Gram']
E         Right contains one more item: 'Gram'
E         Use -v to get the full diff

tests/test_metainfo.py:23: AssertionError
_____________ test_vars[__authors__ = ["Gram"]-authors-expected4] ______________

tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/test_vars___authors_______Gram0')
content = '__authors__ = ["Gram"]', name = 'authors', expected = ['Gram']

    @pytest.mark.parametrize('content, name, expected', [
        ('__license__ = "MIT"', 'license', 'MIT'),
    
        ('__version__ = "0.2.7"', 'version', '0.2.7'),
        ('__version__ = ("0", "2", "7")', 'version', '0.2.7'),
        # ('__version__ = (0, 2, 7)', 'version', '0.2.7'),
    
        ('__author__ = "Gram"', 'authors', ['Gram']),
        ('__authors__ = ["Gram"]', 'authors', ['Gram']),
    
    ])
    def test_vars(tmp_path: Path, content: str, name: str, expected):
        path = tmp_path / 'lol.py'
        path.write_text(content)
        info = MetaInfo.parse(paths=[path])
>       assert getattr(info, name) == expected
E       AssertionError: assert [] == ['Gram']
E         Right contains one more item: 'Gram'
E         Use -v to get the full diff

tests/test_metainfo.py:23: AssertionError
========================= 5 failed, 22 passed in 1.95s =========================

Broken due to use of ast.Str, which doesn't match type checks any more due to https://bugs.python.org/issue32892

Used here:

if type(value) is ast.Str:

if type(element) is not ast.Str:

P.S. Why does this use type(foo) is bar instead of isinstance(foo, bar)?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant