From 738b6eef9cfd57001725606f5d9718b89385ddeb Mon Sep 17 00:00:00 2001 From: "Mike C. Fletcher" Date: Mon, 30 Dec 2024 01:09:09 -0500 Subject: [PATCH] TESTSUITE Get tox suite passing on ubuntu with xfail known-fail and skip for unsupported features --- test-requirements.txt | 1 + tests/test_checks.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/test-requirements.txt b/test-requirements.txt index 4936211f..f0854861 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,3 +5,4 @@ pygame < 2.1.3; python_version < '3.11' pygame >= 2.1.3; python_version >= '3.11' --only-binary pygame psutil +xlib \ No newline at end of file diff --git a/tests/test_checks.py b/tests/test_checks.py index 89a9171a..6c3eeeae 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -5,6 +5,10 @@ from functools import wraps from OpenGL.GLUT import glutInit +try: + import numpy +except ImportError: + numpy = None HERE = os.path.dirname(os.path.abspath(__file__)) log = logging.getLogger(__name__) @@ -29,6 +33,16 @@ def glut_only_test(*args, **named): return glut_only_test +def numpy_only(func): + @wraps(func) + def glut_only_test(*args, **named): + if not numpy: + pytest.skip("No GLUT installed") + return func(*args, **named) + + return glut_only_test + + def check_test(func): filename = func.__name__[5:] + '.py' file = os.path.join(HERE, filename) @@ -82,16 +96,19 @@ def test_check_crash_on_glutinit(): """Checks that basic glut init works""" +@numpy_only @check_test def test_check_egl_es1(): """Checks egl with es1 under pygame""" +@numpy_only @check_test def test_check_egl_es2(): """Checks egl with es2 under pygame""" +@numpy_only @check_test def test_check_egl_opengl(): """Checks egl with opengl under pygame""" @@ -108,6 +125,7 @@ def test_check_glutwindow(): """Checks GLUT window manipulation functions""" +@pytest.mark.xfail @check_test def test_check_egl_pygame(): """Checks egl running over a pygame context""" @@ -124,6 +142,7 @@ def test_check_import_err(): """Checks that the GLU module can be imported""" +@numpy_only @check_test def test_check_leak_on_discontiguous_array(): """Checks that discontiguous array copy doesn't leak the copy"""