From 391ceda581b00e841be7ef49378e656a6334a832 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Tue, 5 Mar 2024 11:27:17 +1100 Subject: [PATCH] python3Packages.pygame: skip failing tests Fixes #293186 --- .../python-modules/pygame/default.nix | 7 ++--- .../pygame/skip-surface-tests.patch | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/python-modules/pygame/skip-surface-tests.patch diff --git a/pkgs/development/python-modules/pygame/default.nix b/pkgs/development/python-modules/pygame/default.nix index ab5727b33add..6bc41339d927 100644 --- a/pkgs/development/python-modules/pygame/default.nix +++ b/pkgs/development/python-modules/pygame/default.nix @@ -59,12 +59,14 @@ buildPythonPackage rec { "${lib.getLib dep}/lib" ]) buildInputs); }) + # Skip tests that should be disabled without video driver + ./skip-surface-tests.patch ]; postPatch = '' substituteInPlace src_py/sysfont.py \ - --replace 'path="fc-list"' 'path="${fontconfig}/bin/fc-list"' \ - --replace /usr/X11/bin/fc-list ${fontconfig}/bin/fc-list + --replace-fail 'path="fc-list"' 'path="${fontconfig}/bin/fc-list"' \ + --replace-fail /usr/X11/bin/fc-list ${fontconfig}/bin/fc-list ''; nativeBuildInputs = [ @@ -102,7 +104,6 @@ buildPythonPackage rec { # No audio or video device in test environment export SDL_VIDEODRIVER=dummy export SDL_AUDIODRIVER=disk - export SDL_DISKAUDIOFILE=/dev/null ${python.interpreter} -m pygame.tests -v --exclude opengl,timing --time_out 300 diff --git a/pkgs/development/python-modules/pygame/skip-surface-tests.patch b/pkgs/development/python-modules/pygame/skip-surface-tests.patch new file mode 100644 index 000000000000..21d9c9060f3b --- /dev/null +++ b/pkgs/development/python-modules/pygame/skip-surface-tests.patch @@ -0,0 +1,26 @@ +diff --git a/test/surface_test.py b/test/surface_test.py +index 5ce78b6e..8b8f7ed5 100644 +--- a/test/surface_test.py ++++ b/test/surface_test.py +@@ -1091,6 +1091,10 @@ class GeneralSurfaceTests(unittest.TestCase): + 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().""" +@@ -1118,6 +1122,10 @@ class GeneralSurfaceTests(unittest.TestCase): + 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()."""