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

ResourceWarning in test_logging.HandlerTest.test_post_fork_child_no_deadlock #81084

Closed
tirkarthi opened this issue May 13, 2019 · 3 comments
Closed
Labels
3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@tirkarthi
Copy link
Member

BPO 36903
Nosy @gpshead, @vstinner, @tirkarthi
PRs
  • bpo-36903: Fix ResourceWarning in test_logging #13283
  • [3.7] bpo-36903: Fix ResourceWarning in test_logging (GH-13283) #13285
  • 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-05-13.15:43:45.662>
    created_at = <Date 2019-05-13.13:55:54.669>
    labels = ['3.7', '3.8', 'type-bug', 'tests']
    title = 'ResourceWarning in test_logging.HandlerTest.test_post_fork_child_no_deadlock'
    updated_at = <Date 2019-05-13.15:43:45.662>
    user = 'https://github.com/tirkarthi'

    bugs.python.org fields:

    activity = <Date 2019-05-13.15:43:45.662>
    actor = 'xtreak'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-13.15:43:45.662>
    closer = 'xtreak'
    components = ['Tests']
    creation = <Date 2019-05-13.13:55:54.669>
    creator = 'xtreak'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36903
    keywords = ['patch']
    message_count = 3.0
    messages = ['342330', '342335', '342344']
    nosy_count = 3.0
    nosy_names = ['gregory.p.smith', 'vstinner', 'xtreak']
    pr_nums = ['13283', '13285']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36903'
    versions = ['Python 3.7', 'Python 3.8']

    @tirkarthi
    Copy link
    Member Author

    There was a test added with 64aa6d2. It opens a stream of '/dev/null' in the test and doesn't close it causing ResourceWarning. A fix would be to assign it to a variable and close it as part of test's cleanup process. I will raise a PR for this.

    ./python.exe -m unittest test.test_logging.HandlerTest.test_post_fork_child_no_deadlock
    /Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_logging.py:142: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='wt' encoding='UTF-8'>
    loggerDict.clear()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    .
    ----------------------------------------------------------------------
    Ran 1 test in 0.606s

    OK

    @tirkarthi tirkarthi added 3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels May 13, 2019
    @vstinner
    Copy link
    Member

    New changeset 2c10538 by Victor Stinner (Xtreak) in branch 'master':
    bpo-36903: Fix ResourceWarning in test_logging (GH-13283)
    2c10538

    @vstinner
    Copy link
    Member

    New changeset 744129d by Victor Stinner (Miss Islington (bot)) in branch '3.7':
    bpo-36903: Fix ResourceWarning in test_logging (GH-13283) (GH-13285)
    744129d

    @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.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants