Skip to content

Commit

Permalink
Fixing test_pickling tests for Python 3.13.
Browse files Browse the repository at this point in the history
The `Handler.lock` is substituted for a `nullcontext`, keeping Python 3.13 happy. A no-op stub for `Handler.release` is added, keeping all other Python versions happy.
  • Loading branch information
etianen committed Feb 12, 2024
1 parent 1e73dd4 commit d6a950f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/test_pickling.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,30 @@ def _stop(self):
self.stopped = True


class MockLock:
def __enter__(self):
pass

def __exit__(self, *excinfo):
pass


class StandardHandler(logging.Handler):
def __init__(self, level):
super().__init__(level)
self.written = ""
self.lock = None

def emit(self, record):
self.written += record.getMessage()

def acquire(self):
pass

def release(self):
pass

def createLock(self): # noqa: N802
return None
self.lock = MockLock()


def format_function(record):
Expand Down

0 comments on commit d6a950f

Please sign in to comment.