def _patch_comet_atexit(monkeypatch):
    """Prevent comet logger from trying to print at exit, since pytest's stdout/stderr redirection breaks it."""
    import atexit

    monkeypatch.setattr(atexit, "register", lambda _: None)
Prevent comet logger from trying to print at exit, since pytest's stdout/stderr redirection breaks it.
tests/tests_pytorch/loggers/test_comet.py