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

ParseError in test_all_project_files() #76018

Closed
serhiy-storchaka opened this issue Oct 21, 2017 · 3 comments
Closed

ParseError in test_all_project_files() #76018

serhiy-storchaka opened this issue Oct 21, 2017 · 3 comments
Labels
tests Tests in the Lib/test dir topic-2to3 type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 31837
Nosy @benjaminp, @serhiy-storchaka, @tirkarthi
Superseder
  • bpo-30117: test_lib2to3.test_parser.test_all_project_files() fails
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-09-26.12:16:18.095>
    created_at = <Date 2017-10-21.17:08:02.335>
    labels = ['tests', 'type-bug', 'expert-2to3']
    title = 'ParseError in test_all_project_files()'
    updated_at = <Date 2018-09-26.12:39:44.748>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-09-26.12:39:44.748>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-09-26.12:16:18.095>
    closer = 'xtreak'
    components = ['Tests', '2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2017-10-21.17:08:02.335>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31837
    keywords = []
    message_count = 3.0
    messages = ['304715', '326457', '326461']
    nosy_count = 3.0
    nosy_names = ['benjamin.peterson', 'serhiy.storchaka', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '30117'
    type = 'behavior'
    url = 'https://bugs.python.org/issue31837'
    versions = []

    @serhiy-storchaka
    Copy link
    Member Author

    test_all_project_files() in test_lib2to3 emits warnings in verbose mode.

    /home/serhiy/py/cpython/Lib/lib2to3/tests/test_parser.py:415: UserWarning: ParseError on file /home/serhiy/py/cpython/Lib/lib2to3/main.py (bad input: type=22, value='=', context=('', (130, 38)))
    warnings.warn('ParseError on file %s (%s)' % (filepath, err))
    /home/serhiy/py/cpython/Lib/lib2to3/tests/test_parser.py:415: UserWarning: ParseError on file /home/serhiy/py/cpython/Lib/lib2to3/tests/pytree_idempotency.py (bad input: type=22, value='=', context=('', (49, 33)))
    warnings.warn('ParseError on file %s (%s)' % (filepath, err))

    ParseError is raised by lines like:

        print("Use --help to show usage.", file=sys.stderr)

    Seems "from __future__ import print_function" doesn't work.

    @serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir topic-2to3 type-bug An unexpected behavior, bug, or error labels Oct 21, 2017
    @tirkarthi
    Copy link
    Member

    The warnings were introduced with bpo-13125 and this was fixed with bpo-30117 . I verified it as below :

    ➜ cpython git:(master) git checkout 14e976e~1
    ➜ cpython git:(ce0f33d) git clean -xdf && ./configure --with-pydebug && make -s -j4
    ➜ cpython git:(ce0f33d) time ./python.exe -I -S -m test.regrtest -vv test_import test_lib2to3 >/dev/null
    Warning -- files was modified by test_import
    Before: []
    After: ['@test_41673_tmp.pyc']
    /Users/karthikeyansingaravelan/stuff/python/cpython/Lib/lib2to3/tests/test_parser.py:430: UserWarning: ParseError on file /Users/karthikeyansingaravelan/stuff/python/cpython/Lib/lib2to3/main.py (bad input: type=22, value='=', context=('', (130, 38)))
    warnings.warn('ParseError on file %s (%s)' % (filepath, err))
    /Users/karthikeyansingaravelan/stuff/python/cpython/Lib/lib2to3/tests/test_parser.py:430: UserWarning: ParseError on file /Users/karthikeyansingaravelan/stuff/python/cpython/Lib/lib2to3/tests/pytree_idempotency.py (bad input: type=22, value='=', context=('', (49, 33)))
    warnings.warn('ParseError on file %s (%s)' % (filepath, err))
    ./python.exe -I -S -m test.regrtest -vv test_import test_lib2to3 > /dev/null 44.31s user 1.18s system 94% cpu 47.971 total

    # Fixed commit

    ➜ cpython git:(14e976e) time ./python.exe -I -S -m test.regrtest -vv test_import test_lib2to3 >/dev/null
    Warning -- files was modified by test_import
    Before: []
    After: ['@test_41839_tmp.pyc']
    ./python.exe -I -S -m test.regrtest -vv test_import test_lib2to3 > /dev/null 50.50s user 1.56s system 91% cpu 56.778 total

    The test_import warning is also not reproducible with master as of now I will find the necessary commit and reply back in bpo-28655. As part of triaging I am closing this as duplicate with bpo-30117 as superseder which has the fix. Feel free to reopen this if needed.

    Thanks

    @serhiy-storchaka
    Copy link
    Member Author

    Thanks Karthikeyan!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir topic-2to3 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants