Skip to content

Do not monkeypatch logging.raiseExceptions?! #4942

@blueyed

Description

@blueyed

I have found the following code, which was added in 2c7d005 by @hpk42, but apparently without a test:

# make sure logging does not raise exceptions at the end
def silence_logging_at_shutdown():
if "logging" in sys.modules:
sys.modules["logging"].raiseExceptions = False
early_config.add_cleanup(silence_logging_at_shutdown)

A later commit (0719602) indicates that this might be because logging itself tries to close some fd.

I think it is bad practice to change module attributes, especially if it might indicate that pytest is/was doing something wrong itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: capturerelated to the capture builtin plugintype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions