Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests fail under Python 3.8 #63

Closed
carlwgeorge opened this issue Mar 21, 2019 · 8 comments
Closed

tests fail under Python 3.8 #63

carlwgeorge opened this issue Mar 21, 2019 · 8 comments

Comments

@carlwgeorge
Copy link

I noticed that Python 3.8 is at least on your mind due to #47 and #52. However I discovered that the tests do not pass on that version. Using the python:3.8.0a2 container image from Docker Hub, I cloned this repo, ran pip install -e .[testing], then pytest, and got many failures.

pytest output (click to expand)
root@tassadar:~/parso# pytest 
========================================================= test session starts ==========================================================
platform linux -- Python 3.8.0a2, pytest-4.3.1, py-1.8.0, pluggy-0.9.0
rootdir: /root/parso, inifile: pytest.ini
collected 937 items                                                                                                                    

parso/__init__.py .                                                                                                              [  0%]
parso/python/tree.py .                                                                                                           [  0%]
test/test_absolute_import.py ...                                                                                                 [  0%]
test/test_cache.py ..                                                                                                            [  0%]
test/test_diff_parser.py ............................................................                                            [  7%]
test/test_error_recovery.py ............                                                                                         [  8%]
test/test_file_python_errors.py .......                                                                                          [  9%]
test/test_fstring.py .................................                                                                           [ 12%]
test/test_get_code.py ......                                                                                                     [ 13%]
test/test_grammar.py .                                                                                                           [ 13%]
test/test_load_grammar.py ............                                                                                           [ 14%]
test/test_normalizer_issues_files.py ..................................                                                          [ 18%]
test/test_old_fast_parser.py ...............                                                                                     [ 19%]
test/test_param_splitting.py .........                                                                                           [ 20%]
test/test_parser.py ............................................................................................................ [ 32%]
.............                                                                                                                    [ 33%]
test/test_parser_tree.py ...................................................                                                     [ 39%]
test/test_pep8.py ...                                                                                                            [ 39%]
test/test_pgen2.py .......................x..................................................................................... [ 51%]
................................................................................................................................ [ 64%]
.................................................                                                                                [ 70%]
test/test_prefix.py .....................                                                                                        [ 72%]
test/test_python_errors.py ..F....F......FF..........FF........FFFFFFFFFFFFFFFFFFFFF.FFFFFFFFFFFFF................F............. [ 83%]
..................................FF.FFF.......F................................................                                 [ 93%]
test/test_tokenize.py ........................................                                                                   [ 97%]
test/test_utils.py ......................                                                                                        [100%]

=============================================================== FAILURES ===============================================================
________________ test_python_exception_matches[for a in [1]:\n    try:\n        pass\n    finally:\n        continue\n] ________________

code = 'for a in [1]:\n    try:\n        pass\n    finally:\n        continue\n'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
>       wanted, line_nr = _get_actual_exception(code)

test/test_python_errors.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

code = 'for a in [1]:\n    try:\n        pass\n    finally:\n        continue\n'

    def _get_actual_exception(code):
        with warnings.catch_warnings():
            # We don't care about warnings where locals/globals misbehave here.
            # It's as simple as either an error or not.
            warnings.filterwarnings('ignore', category=SyntaxWarning)
            try:
                compile(code, '<unknown>', 'exec')
            except (SyntaxError, IndentationError) as e:
                wanted = e.__class__.__name__ + ': ' + e.msg
                line_nr = e.lineno
            except ValueError as e:
                # The ValueError comes from byte literals in Python 2 like '\x'
                # that are oddly enough not SyntaxErrors.
                wanted = 'SyntaxError: (value error) ' + str(e)
                line_nr = None
            else:
>               assert False, "The piece of code should raise an exception."
E               AssertionError: The piece of code should raise an exception.
E               assert False

test/test_python_errors.py:95: AssertionError
_________________________________________ test_python_exception_matches[f(x for x in bar, 1)] __________________________________________

code = 'f(x for x in bar, 1)'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: positional argument follows keyword argument' in ['SyntaxError: Generator expression must be parenthesized']

test/test_python_errors.py:39: AssertionError
_____________________________________________ test_python_exception_matches[__debug__ = 1] _____________________________________________

code = '__debug__ = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: assignment to keyword' in ['SyntaxError: cannot assign to __debug__']

test/test_python_errors.py:39: AssertionError
______________________________________ test_python_exception_matches[with x() as __debug__: pass] ______________________________________

code = 'with x() as __debug__: pass'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert 'SyntaxError: assignment to keyword' in ['SyntaxError: cannot assign to __debug__']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[foo(+a=3)] _______________________________________________

code = 'foo(+a=3)'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: keyword can't be an expression" in ['SyntaxError: expression cannot contain assignment, perhaps you meant "=="?']

test/test_python_errors.py:39: AssertionError
____________________________________________ test_python_exception_matches[f(lambda: 1=1)] _____________________________________________

code = 'f(lambda: 1=1)'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert 'SyntaxError: lambda cannot contain assignment' in ['SyntaxError: expression cannot contain assignment, perhaps you meant "=="?']

test/test_python_errors.py:39: AssertionError
____________________________________________ test_python_exception_matches[lambda a: 1 = 1] ____________________________________________

code = 'lambda a: 1 = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to lambda" in ['SyntaxError: cannot assign to lambda']

test/test_python_errors.py:39: AssertionError
__________________________________________ test_python_exception_matches[[x for x in y] = 1] ___________________________________________

code = '[x for x in y] = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: cannot assign to list comprehension']

test/test_python_errors.py:39: AssertionError
__________________________________________ test_python_exception_matches[{x for x in y} = 1] ___________________________________________

code = '{x for x in y} = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to set comprehension']

test/test_python_errors.py:39: AssertionError
_________________________________________ test_python_exception_matches[{x:x for x in y} = 1] __________________________________________

code = '{x:x for x in y} = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to dict comprehension']

test/test_python_errors.py:39: AssertionError
__________________________________________ test_python_exception_matches[(x for x in y) = 1] ___________________________________________

code = '(x for x in y) = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: cannot assign to generator expression']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[None = 1] ________________________________________________

code = 'None = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to keyword" in ['SyntaxError: cannot assign to None']

test/test_python_errors.py:39: AssertionError
________________________________________________ test_python_exception_matches[... = 1] ________________________________________________

code = '... = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to Ellipsis" in ['SyntaxError: cannot assign to Ellipsis']

test/test_python_errors.py:39: AssertionError
______________________________________________ test_python_exception_matches[a == b = 1] _______________________________________________

code = 'a == b = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to comparison" in ['SyntaxError: cannot assign to comparison']

test/test_python_errors.py:39: AssertionError
______________________________________________ test_python_exception_matches[{a, b} = 1] _______________________________________________

code = '{a, b} = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to set display']

test/test_python_errors.py:39: AssertionError
______________________________________________ test_python_exception_matches[{a: b} = 1] _______________________________________________

code = '{a: b} = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to dict display']

test/test_python_errors.py:39: AssertionError
_________________________________________________ test_python_exception_matches[1 = 1] _________________________________________________

code = '1 = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
________________________________________________ test_python_exception_matches["" = 1] _________________________________________________

code = '"" = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[b"" = 10] ________________________________________________

code = 'b"" = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[b"" = 11] ________________________________________________

code = 'b"" = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches["" "" = 1] _______________________________________________

code = '"" "" = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[1 | 1 = 3] _______________________________________________

code = '1 | 1 = 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to operator" in ['SyntaxError: cannot assign to operator']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[1**1 = 3] ________________________________________________

code = '1**1 = 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to operator" in ['SyntaxError: cannot assign to operator']

test/test_python_errors.py:39: AssertionError
________________________________________________ test_python_exception_matches[~ 1 = 3] ________________________________________________

code = '~ 1 = 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to operator" in ['SyntaxError: cannot assign to operator']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[not 1 = 3] _______________________________________________

code = 'not 1 = 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to operator" in ['SyntaxError: cannot assign to operator']

test/test_python_errors.py:39: AssertionError
______________________________________________ test_python_exception_matches[1 and 1 = 3] ______________________________________________

code = '1 and 1 = 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to operator" in ['SyntaxError: cannot assign to operator']

test/test_python_errors.py:39: AssertionError
_______________________________________ test_python_exception_matches[def foo(): (yield 1) = 3] ________________________________________

code = 'def foo(): (yield 1) = 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to yield expression" in ['SyntaxError: cannot assign to yield expression']

test/test_python_errors.py:39: AssertionError
_____________________________________ test_python_exception_matches[async def foo(): await x = 3] ______________________________________

code = 'async def foo(): await x = 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to await expression" in ['SyntaxError: cannot assign to await expression']

test/test_python_errors.py:39: AssertionError
__________________________________________ test_python_exception_matches[(a if a else a) = a] __________________________________________

code = '(a if a else a) = a'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to conditional expression" in ['SyntaxError: cannot assign to conditional expression']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[a, 1 = x] ________________________________________________

code = 'a, 1 = x'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[foo() = 1] _______________________________________________

code = 'foo() = 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to function call" in ['SyntaxError: cannot assign to function call']

test/test_python_errors.py:39: AssertionError
_________________________________________ test_python_exception_matches[with x as foo(): pass] _________________________________________

code = 'with x as foo(): pass'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to function call" in ['SyntaxError: cannot assign to function call']

test/test_python_errors.py:39: AssertionError
______________________________________________ test_python_exception_matches[del bar, 1] _______________________________________________

code = 'del bar, 1'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't delete literal" in ['SyntaxError: cannot delete literal']

test/test_python_errors.py:39: AssertionError
_________________________________________ test_python_exception_matches[for x, 1 in []: pass] __________________________________________

code = 'for x, 1 in []: pass'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
________________________________________ test_python_exception_matches[for (not 1) in []: pass] ________________________________________

code = 'for (not 1) in []: pass'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to operator" in ['SyntaxError: cannot assign to operator']

test/test_python_errors.py:39: AssertionError
____________________________________________ test_python_exception_matches[[x for 1 in y]] _____________________________________________

code = '[x for 1 in y]'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
___________________________________________ test_python_exception_matches[[x for a, 3 in y]] ___________________________________________

code = '[x for a, 3 in y]'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
____________________________________________ test_python_exception_matches[(x for 1 in y)] _____________________________________________

code = '(x for 1 in y)'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
____________________________________________ test_python_exception_matches[{x for 1 in y}] _____________________________________________

code = '{x for 1 in y}'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
___________________________________________ test_python_exception_matches[{x:x for 1 in y}] ____________________________________________

code = '{x:x for 1 in y}'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
__________________________________________ test_python_exception_matches[{**{} for a in [1]}] __________________________________________

code = '{**{} for a in [1]}'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: dict unpacking cannot be used in dict comprehension']

test/test_python_errors.py:39: AssertionError
_________________________ test_python_exception_matches[async def foo():\n def nofoo():[x async for x in []]] __________________________

code = 'async def foo():\n def nofoo():[x async for x in []]'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
>       errors = _get_error_list(code)

test/test_python_errors.py:34: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/test_python_errors.py:22: in _get_error_list
    return list(grammar.iter_errors(tree))
parso/grammar.py:165: in iter_errors
    return self._get_normalizer_issues(node, self._error_normalizer_config)
parso/grammar.py:185: in _get_normalizer_issues
    normalizer.walk(node)
parso/normalizer.py:34: in walk
    value = self.visit(node)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:45: in visit
    return ''.join(self.visit(child) for child in children)
parso/normalizer.py:45: in <genexpr>
    return ''.join(self.visit(child) for child in children)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:45: in visit
    return ''.join(self.visit(child) for child in children)
parso/normalizer.py:45: in <genexpr>
    return ''.join(self.visit(child) for child in children)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:45: in visit
    return ''.join(self.visit(child) for child in children)
parso/normalizer.py:45: in <genexpr>
    return ''.join(self.visit(child) for child in children)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:45: in visit
    return ''.join(self.visit(child) for child in children)
parso/normalizer.py:45: in <genexpr>
    return ''.join(self.visit(child) for child in children)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:45: in visit
    return ''.join(self.visit(child) for child in children)
parso/normalizer.py:45: in <genexpr>
    return ''.join(self.visit(child) for child in children)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:45: in visit
    return ''.join(self.visit(child) for child in children)
parso/normalizer.py:45: in <genexpr>
    return ''.join(self.visit(child) for child in children)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:45: in visit
    return ''.join(self.visit(child) for child in children)
parso/normalizer.py:45: in <genexpr>
    return ''.join(self.visit(child) for child in children)
parso/python/errors.py:280: in visit
    return super(ErrorFinder, self).visit(node)
parso/normalizer.py:44: in visit
    with self.visit_node(node):
/usr/local/lib/python3.8/contextlib.py:113: in __enter__
    return next(self.gen)
parso/python/errors.py:285: in visit_node
    self._check_type_rules(node)
parso/normalizer.py:54: in _check_type_rules
    rule.feed_node(node)
parso/normalizer.py:182: in feed_node
    if self.is_issue(node):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <parso.python.errors._CompForRule object at 0x7f2dfe14cb50>, node = <CompFor: async for x in []@2,16>

    def is_issue(self, node):
        # Some of the nodes here are already used, so no else if
>       expr_list = node.children[1 + int(node.children[0] == 'async')]
E       IndexError: list index out of range

parso/python/errors.py:948: IndexError
__________________________________________ test_python_exception_matches[[*[] for a in [1]]] ___________________________________________

code = '[*[] for a in [1]]'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       AssertionError: assert None in ['SyntaxError: iterable unpacking cannot be used in comprehension']

test/test_python_errors.py:39: AssertionError
_______________________________________________ test_python_exception_matches[del None] ________________________________________________

code = 'del None'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't delete keyword" in ['SyntaxError: cannot delete None']

test/test_python_errors.py:39: AssertionError
______________________________________________ test_python_exception_matches[(True,) = x] ______________________________________________

code = '(True,) = x'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to keyword" in ['SyntaxError: cannot assign to True']

test/test_python_errors.py:39: AssertionError
___________________________________________ test_python_exception_matches[([False], a) = x] ____________________________________________

code = '([False], a) = x'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to keyword" in ['SyntaxError: cannot assign to False']

test/test_python_errors.py:39: AssertionError
______________________________________________ test_python_exception_matches[[a, 1] += 3] ______________________________________________

code = '[a, 1] += 3'

    @pytest.mark.parametrize('code', FAILING_EXAMPLES)
    def test_python_exception_matches(code):
        wanted, line_nr = _get_actual_exception(code)
    
        errors = _get_error_list(code)
        actual = None
        if errors:
            error, = errors
            actual = error.message
>       assert actual in wanted
E       assert "SyntaxError: can't assign to literal" in ['SyntaxError: cannot assign to literal']

test/test_python_errors.py:39: AssertionError
========================================== 47 failed, 889 passed, 1 xfailed in 11.89 seconds ===========================================

I was able to reproduce the same errors using the python38 package in Fedora.

@davidhalter
Copy link
Owner

davidhalter commented Mar 21, 2019

Thanks for the report! These errors are probably not that from looking at it. Probably quite easily fixable, but hard to do it well without the CI support.

We should look at this once 3.8 releases (or a bit before)

@carlwgeorge
Copy link
Author

Yeah, I'm aware Travis CI is limited on what Python versions are available to use. I don't know if you are open to exploring other CI systems, but there are others with more flexibility that would enable you to run tests with 3.8 without waiting for the final release. Many of them let you run tests in any arbitrary container image (i.e. python:3.8.0a2). Cirrus CI even lets you "bring your own infrastructure" and/or use containers on their shared cluster.

@blueyed
Copy link
Contributor

blueyed commented Mar 22, 2019

Yes, Travis is a bit limited, but it would allow for "3.8-dev".

@davidhalter
Copy link
Owner

@carlwgeorge I basically don't care on which CI it is running. It's just that I don't want to invest too much time into switching the CI. If you want to add it, feel free. Until then, we can probably just add 3.8-dev or is there a python-dev or something?

@hroncok
Copy link
Contributor

hroncok commented Mar 29, 2019

We should look at this once 3.8 releases.

Please try supporting 3.8 before it is released. That's one of the reasons why those prereleases exist - so the ecosystem can be prepared for the final release.

Should be 3.8-dev #64

@davidhalter
Copy link
Owner

We still have a year ;)

But you're right we should fix it soonish. There's just so much I have to with all the projects...

@hroncok
Copy link
Contributor

hroncok commented Mar 30, 2019

We still have a year ;)

3.8 final is scheduled in 7 months.

There's just so much I have to with all the projects...

If you need help with patches from the Fedora Python SIG, let us know. I don't know parso at all, so contributing might be hard, but we can definitively allocate some time for this. We want to start putting 3.8 into Fedora 31 around first beta (end of May).

@davidhalter
Copy link
Owner

Ok after pip didn't work after trying half an hour I just hacked the sys path with a few path files (pip does nothing else anyway)... It's pretty annoying to get Python 3.8 properly running, haha. No offense to anyone.

I fixed it now. Python 3.8 might change again, so there might be other issues in the future. But I feel like most things will likely remain the same. I also released it (for other reasons).

If you need help with patches from the Fedora Python SIG, let us know

I always need help :) If people want to help out, please help with Jedi bugs.

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

No branches or pull requests

4 participants