Skip to content

Use self.assertRaises instead of try/except in ctypes/test_functions.py::test_mro #90036

Description

@sobolevn
BPO 45878
Nosy @serhiy-storchaka, @miss-islington, @sobolevn
PRs
  • bpo-45878: convert try/except to self.assertRaises in Lib/ctypes/test/test_functions.py #29721
  • [3.10] bpo-45878: convert try/except to self.assertRaises in Lib/ctypes/test/test_functions.py (GH-29721) #29722
  • [3.9] bpo-45878: convert try/except to self.assertRaises in Lib/ctypes/test/test_functions.py (GH-29721) #29723
  • [3.10] bpo-45878: convert try/except to self.assertRaises in Lib/ctypes/test/test_functions.py (GH-29721) #29748
  • [3.10] Remove a NEWS entry for bpo-45878. #30258
  • Remove a NEWS entry for bpo-45878. #30259
  • [3.9] Remove a NEWS entry for bpo-45878 (GH-30258) #30260
  • 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 2021-12-02.22:45:04.051>
    created_at = <Date 2021-11-23.09:32:54.593>
    labels = ['type-bug', 'tests', '3.9', '3.10', '3.11']
    title = 'Use `self.assertRaises` instead of `try/except` in `ctypes/test_functions.py::test_mro`'
    updated_at = <Date 2021-12-26.11:26:02.194>
    user = 'https://github.com/sobolevn'

    bugs.python.org fields:

    activity = <Date 2021-12-26.11:26:02.194>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-12-02.22:45:04.051>
    closer = 'sobolevn'
    components = ['Tests']
    creation = <Date 2021-11-23.09:32:54.593>
    creator = 'sobolevn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45878
    keywords = ['patch']
    message_count = 7.0
    messages = ['406829', '406836', '409133', '409134', '409186', '409187', '409191']
    nosy_count = 3.0
    nosy_names = ['serhiy.storchaka', 'miss-islington', 'sobolevn']
    pr_nums = ['29721', '29722', '29723', '29748', '30258', '30259', '30260']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45878'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. sobolevn commented on Nov 23, 2021

      @sobolevn
      MemberAuthor

      Right now this test uses try: ... except TypeError: ... to ensure that mro is consistent. This has a flaw: code in try might not ever raise and this test would still pass.

      I will refactor it to use self.assertRaises to be 100% sure.

    2. added
      testsTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or error
      on Nov 23, 2021
    3. serhiy-storchaka commented on Nov 23, 2021

      @serhiy-storchaka
      Member

      New changeset b48ac6f by Nikita Sobolev in branch 'main':
      bpo-45878: convert try/except to self.assertRaises in [Lib/ctypes/test/test_functions.py](https://github.com/python/cpython/blob/main/Lib/ctypes/test/test_functions.py) (GH-29721)
      b48ac6f

    4. serhiy-storchaka commented on Dec 24, 2021

      @serhiy-storchaka
      Member

      New changeset 393ff04 by Miss Islington (bot) in branch '3.9':
      bpo-45878: convert try/except to self.assertRaises in [Lib/ctypes/test/test_functions.py](https://github.com/python/cpython/blob/main/Lib/ctypes/test/test_functions.py) (GH-29721) (GH-29723)
      393ff04

    5. serhiy-storchaka commented on Dec 24, 2021

      @serhiy-storchaka
      Member

      New changeset a9e0b2b by Miss Islington (bot) in branch '3.10':
      bpo-45878: convert try/except to self.assertRaises in [Lib/ctypes/test/test_functions.py](https://github.com/python/cpython/blob/main/Lib/ctypes/test/test_functions.py) (GH-29721) (GH-29748)
      a9e0b2b

    6. serhiy-storchaka commented on Dec 26, 2021

      @serhiy-storchaka
      Member

      New changeset 11909c1 by Serhiy Storchaka in branch '3.10':
      [3.10] Remove a NEWS entry for bpo-45878 (GH-30258)
      11909c1

    7. serhiy-storchaka commented on Dec 26, 2021

      @serhiy-storchaka
      Member

      New changeset 1fb7c61 by Serhiy Storchaka in branch 'main':
      Remove a NEWS entry for bpo-45878 (GH-30259)
      1fb7c61

    8. serhiy-storchaka commented on Dec 26, 2021

      @serhiy-storchaka
      Member

      New changeset bee660e by Miss Islington (bot) in branch '3.9':
      [3.9] Remove a NEWS entry for bpo-45878 (GH-30258) (GH-30260)
      bee660e

    9. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of life3.11only security fixes3.9 (EOL)end of lifetestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions