From 656eb5d986873ec7297bd19afeee62f05d16170a Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Tue, 5 Mar 2024 11:42:09 +1100 Subject: [PATCH] Skip surface tests that fail when `SDL_VIDEODRIVER=dummy` --- test/surface_test.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/surface_test.py b/test/surface_test.py index e6dc1ad095..b1147d278f 100644 --- a/test/surface_test.py +++ b/test/surface_test.py @@ -1091,6 +1091,10 @@ def test_image_convert_bug_131(self): finally: pygame.display.quit() + @unittest.skipIf( + os.environ.get("SDL_VIDEODRIVER") == "dummy", + 'requires a non-"dummy" SDL_VIDEODRIVER', + ) def test_convert_init(self): """Ensure initialization exceptions are raised for surf.convert().""" @@ -1101,12 +1105,11 @@ def test_convert_init(self): pygame.display.init() try: - if os.environ.get("SDL_VIDEODRIVER") != "dummy": - try: - surf.convert(32) - surf.convert(pygame.Surface((1, 1))) - except pygame.error: - self.fail("convert() should not raise an exception here.") + try: + surf.convert(32) + surf.convert(pygame.Surface((1, 1))) + except pygame.error: + self.fail("convert() should not raise an exception here.") self.assertRaisesRegex(pygame.error, "No video mode", surf.convert) @@ -1118,6 +1121,10 @@ def test_convert_init(self): finally: pygame.display.quit() + @unittest.skipIf( + os.environ.get("SDL_VIDEODRIVER") == "dummy", + 'requires a non-"dummy" SDL_VIDEODRIVER', + ) def test_convert_alpha_init(self): """Ensure initialization exceptions are raised for surf.convert_alpha()."""