mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 08:12:33 +03:00
Only test register_handler in a single thread
This commit is contained in:
parent
64eed14867
commit
60bf46fef9
|
@ -51,6 +51,9 @@ def test_save(tmp_path: Path) -> None:
|
|||
|
||||
|
||||
def test_handler(tmp_path: Path) -> None:
|
||||
if BufrStubImagePlugin._handler is not None:
|
||||
return
|
||||
|
||||
class TestHandler(ImageFile.StubHandler):
|
||||
opened = False
|
||||
loaded = False
|
||||
|
|
|
@ -51,6 +51,9 @@ def test_save(tmp_path: Path) -> None:
|
|||
|
||||
|
||||
def test_handler(tmp_path: Path) -> None:
|
||||
if GribStubImagePlugin._handler is not None:
|
||||
return
|
||||
|
||||
class TestHandler(ImageFile.StubHandler):
|
||||
opened = False
|
||||
loaded = False
|
||||
|
|
|
@ -53,6 +53,9 @@ def test_save() -> None:
|
|||
|
||||
|
||||
def test_handler(tmp_path: Path) -> None:
|
||||
if Hdf5StubImagePlugin._handler is not None:
|
||||
return
|
||||
|
||||
class TestHandler(ImageFile.StubHandler):
|
||||
opened = False
|
||||
loaded = False
|
||||
|
|
|
@ -34,8 +34,7 @@ def test_load() -> None:
|
|||
assert im.load()[0, 0] == (255, 255, 255)
|
||||
|
||||
|
||||
def test_register_handler(tmp_path: Path) -> None:
|
||||
class TestHandler(ImageFile.StubHandler):
|
||||
class TestHandler(ImageFile.StubHandler):
|
||||
methodCalled = False
|
||||
|
||||
def load(self, im: ImageFile.StubImageFile) -> Image.Image:
|
||||
|
@ -44,6 +43,11 @@ def test_register_handler(tmp_path: Path) -> None:
|
|||
def save(self, im: Image.Image, fp: IO[bytes], filename: str) -> None:
|
||||
self.methodCalled = True
|
||||
|
||||
|
||||
def test_register_handler(tmp_path: Path) -> None:
|
||||
if isinstance(WmfImagePlugin._handler, TestHandler):
|
||||
return
|
||||
|
||||
handler = TestHandler()
|
||||
original_handler = WmfImagePlugin._handler
|
||||
WmfImagePlugin.register_handler(handler)
|
||||
|
|
Loading…
Reference in New Issue
Block a user