Skip to content

test_tutorials.py GLException invalid enum on MacOS #2534

Closed
@cdeil

Description

@cdeil

In addition to #2533 I get this error on MacOS with Python 3.13. (Those are the only two.)

Is this something that can / should be investigated or fixed in Arcade or pyglet?

Or is it something that can be ignored and e.g. the test could be marked skip or fail on MacOS?

(.env) cdeil@Kryvoff-MBP arcade % pytest tests/integration/tutorials/test_tutorials.py::test_tutorials
================================ test session starts =================================
platform darwin -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/cdeil/code/oss/arcade
configfile: pyproject.toml
plugins: cov-5.0.0, anyio-4.8.0, mock-3.14.0
collected 70 items                                                                   

tests/integration/tutorials/test_tutorials.py ................................ [ 45%]
...................F..................                                         [100%]

====================================== FAILURES ======================================
_________________________ test_tutorials[file_path51-False] __________________________

window_proxy = None
file_path = PosixPath('/Users/cdeil/code/oss/arcade/doc/tutorials/compute_shader/main.py')
allow_stdout = False

    @pytest.mark.parametrize(
        "file_path, allow_stdout",
        find_tutorials(),
    )
    def test_tutorials(window_proxy, file_path, allow_stdout):
        """Run all tutorials"""
        os.environ["ARCADE_TEST"] = "TRUE"
        stdout = io.StringIO()
        with contextlib.redirect_stdout(stdout):
            # Manually load the module as __main__ so it runs on import
            os.chdir(file_path.parent)
            loader = SourceFileLoader("__main__", str(file_path))
>           loader.exec_module(loader.load_module())

/Users/cdeil/code/oss/arcade/tests/integration/tutorials/test_tutorials.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
<frozen importlib._bootstrap_external>:680: in _check_name_wrapper
    ???
<frozen importlib._bootstrap_external>:1207: in load_module
    ???
<frozen importlib._bootstrap_external>:1031: in load_module
    ???
<frozen importlib._bootstrap>:534: in _load_module_shim
    ???
<frozen importlib._bootstrap>:866: in _exec
    ???
<frozen importlib._bootstrap_external>:1026: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
/Users/cdeil/code/oss/arcade/doc/tutorials/compute_shader/main.py:204: in <module>
    app = NBodyGravityWindow()
/Users/cdeil/code/oss/arcade/doc/tutorials/compute_shader/main.py:155: in __init__
    self.compute_shader = self.ctx.compute_shader(source=compute_shader_source)
/Users/cdeil/code/oss/arcade/arcade/gl/context.py:1333: in compute_shader
    return ComputeShader(self, src.get_source())
/Users/cdeil/code/oss/arcade/arcade/gl/compute_shader.py:48: in __init__
    self._shader_obj = gl.glCreateShader(gl.GL_COMPUTE_SHADER)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

result = 0, func = <_FuncPtr object at 0x10677b1d0>, arguments = (37305,)

    def errcheck(result: Any, func: Callable, arguments: Sequence) -> Any:
        if _debug_gl_trace:
            try:
                name = func.__name__
            except AttributeError:
                name = repr(func)
            if _debug_gl_trace_args:
                trace_args = ', '.join([repr(arg)[:20] for arg in arguments])
                print(f'{name}({trace_args})')
            else:
                print(name)
    
        from pyglet import gl
        if not gl.current_context:
            raise GLException('No GL context; create a Window first')
        error = gl.glGetError()
        if error:
            # These are the 6 possible error codes we can get in opengl core 3.3+
            error_types = {
                gl.GL_INVALID_ENUM: "Invalid enum. An unacceptable value is specified for an enumerated argument.",
                gl.GL_INVALID_VALUE: "Invalid value. A numeric argument is out of range.",
                gl.GL_INVALID_OPERATION: "Invalid operation. The specified operation is not allowed in the current state.",
                gl.GL_INVALID_FRAMEBUFFER_OPERATION: "Invalid framebuffer operation. The framebuffer object is not "
                                                     "complete.",
                gl.GL_OUT_OF_MEMORY: "Out of memory. There is not enough memory left to execute the command.",
            }
            error_msg = error_types.get(error, "Unknown error")
            msg = f'(0x{error}): {error_msg}'
>           raise GLException(msg)
E           pyglet.gl.lib.GLException: (0x1280): Invalid enum. An unacceptable value is specified for an enumerated argument.

/Users/cdeil/code/oss/arcade/.env/lib/python3.13/site-packages/pyglet/gl/lib.py:83: GLException
================================== warnings summary ==================================
tests/integration/tutorials/test_tutorials.py: 70 warnings
  <frozen importlib._bootstrap>:530: DeprecationWarning: the load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead

tests/integration/tutorials/test_tutorials.py::test_tutorials[file_path60-False]
  /Users/cdeil/code/oss/arcade/arcade/exceptions.py:138: PerformanceWarning: draw_text is an extremely slow function for displaying text. Consider using Text objects instead.
    warnings.warn(message, warning_type)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================== short test summary info ===============================
FAILED tests/integration/tutorials/test_tutorials.py::test_tutorials[file_path51-False] - pyglet.gl.lib.GLException: (0x1280): Invalid enum. An unacceptable value is speci...
===================== 1 failed, 69 passed, 71 warnings in 1.78s ======================

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions