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

test_coroutine.test_unawaited_warning_when_module_broken fails on -Werror #81281

Closed
tirkarthi opened this issue May 30, 2019 · 5 comments
Closed
Labels
3.8 only security fixes tests Tests in the Lib/test dir

Comments

@tirkarthi
Copy link
Member

BPO 37100
Nosy @vstinner, @tirkarthi
PRs
  • bpo-37100: Fix test_coroutines with -Werror #13756
  • 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 2019-06-03.00:55:10.133>
    created_at = <Date 2019-05-30.12:57:05.245>
    labels = ['3.8', 'tests']
    title = 'test_coroutine.test_unawaited_warning_when_module_broken fails on -Werror'
    updated_at = <Date 2019-06-03.00:55:10.132>
    user = 'https://github.com/tirkarthi'

    bugs.python.org fields:

    activity = <Date 2019-06-03.00:55:10.132>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-03.00:55:10.133>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2019-05-30.12:57:05.245>
    creator = 'xtreak'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37100
    keywords = ['patch']
    message_count = 5.0
    messages = ['343974', '343976', '344327', '344338', '344350']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'xtreak']
    pr_nums = ['13756']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue37100'
    versions = ['Python 3.8']

    @tirkarthi
    Copy link
    Member Author

    Running test_coroutines under -Werror raises error. It seems ZeroDivisionError is expected and RuntimeWarning is raised and happens only under -Werror. This test was added with e4d300e .

    ./python.exe -Werror -m test test_coroutines
    Run tests sequentially
    0:00:00 load avg: 2.02 [1/1] test_coroutines
    test test_coroutines failed -- Traceback (most recent call last):
      File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_coroutines.py", line 2263, in test_unawaited_warning_when_module_broken
        self.assertEqual(cm.unraisable.exc_type, ZeroDivisionError)
    AssertionError: <class 'RuntimeWarning'> != <class 'ZeroDivisionError'>

    test_coroutines failed

    == Tests result: FAILURE ==

    1 test failed:
    test_coroutines

    Total duration: 436 ms
    Tests result: FAILURE

    @tirkarthi tirkarthi added 3.8 only security fixes tests Tests in the Lib/test dir labels May 30, 2019
    @tirkarthi
    Copy link
    Member Author

    The coroutine is not awaited in the test and generates a RuntimeWarning. Since I used -Werror I guess the warning was converted to an error and thus replacing ZeroDivisionError in the support.catch_unraisable_exception context manager.

    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2019

    I wrote PR 13756 which fix the test.

    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2019

    New changeset 3cf7ea1 by Victor Stinner in branch 'master':
    bpo-37100: Fix test_coroutines with -Werror (GH-13756)
    3cf7ea1

    @vstinner
    Copy link
    Member

    vstinner commented Jun 3, 2019

    It's now fixed, thanks for the report!

    @vstinner vstinner closed this as completed Jun 3, 2019
    @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
    3.8 only security fixes tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants