Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestCoreDatatype.test_buffer_api_basic fails on s390x platform #92

Open
swt2c opened this issue Jan 26, 2023 · 1 comment
Open

TestCoreDatatype.test_buffer_api_basic fails on s390x platform #92

swt2c opened this issue Jan 26, 2023 · 1 comment

Comments

@swt2c
Copy link
Contributor

swt2c commented Jan 26, 2023

I'm seeing TestCoreDatatype.test_buffer_api_basic fail but only on the s390x platform. This is on Fedora Rawhide with pyopengl 3.1.6. Note that it passes on all the other platforms. s390x is big endian so that might be a possible clue (all the others are little endian).

=================================== FAILURES ===================================
____________________ TestCoreDatatype.test_buffer_api_basic ____________________
self = <test_arraydatatype.TestCoreDatatype testMethod=test_buffer_api_basic>
    @pytest.mark.skipif( not (
        OpenGL.USE_ACCELERATE and acceleratesupport.ACCELERATE_AVAILABLE
    ), reason="Need OpenGL_accelerate for buffer support")
    def test_buffer_api_basic(self):
        import array as silly_array
        structures = [
            (b'this and that',13,1,True,1,b'B',[13],[1]),
        ]
        if sys.version_info[:2] >= (2,7):
            structures.append(
                # on Python 3.4 we do *not* get the (3) prefix :(
                ((GLint * 3)( 1,2,3 ),12,4,False,1,[b'(3)<i',b'(3)<l',b'<i',b'<l'],[3],None),
            )
    
        if sys.version_info[:2] >= (3,0):
            # only supports buffer protocol in 3.x
            structures.extend([
                (silly_array.array('I',[1,2,3]),12,4,False,1,b'I',[3],[4]),
            ])
        try:
            structures.append( (memoryview(b'this'),4,1,True,1,b'B',[4],[1]) )
        except NameError:
            # Python 2.6 doesn't have memory view
            pass
        try:
            if array:
                structures.extend( [
                    (arange(0,9,dtype='I').reshape((3,3)),36,4,False,2,b'I',[3,3],[12,4]),
                    (arange(0,9,dtype='I').reshape((3,3))[:,1],12,4,False,1,b'I',[3],[12]),
                ])
        except NameError:
            # Don't have numpy installed...
            pass
    
        from OpenGL.arrays import _buffers
        for object,length,itemsize,readonly,ndim,format,shape,strides in structures:
            buf = _buffers.Py_buffer.from_object( object, _buffers.PyBUF_STRIDES|_buffers.PyBUF_FORMAT )
            with buf:
                assert buf.len == length, (object,length,buf.len)
                assert buf.itemsize == itemsize, (object,itemsize,buf.itemsize)
                assert buf.readonly == readonly, (object,readonly,buf.readonly)
                assert buf.ndim == ndim, (object,ndim,buf.ndim)
                if isinstance( format, list):
>                   assert buf.format in format, (object,format,buf.format)
E                   AssertionError: (<test_arraydatatype.c_int_Array_3 object at 0x3ff301e6950>, [b'(3)<i', b'(3)<l', b'<i', b'<l'], b'>i')
E                   assert b'>i' in [b'(3)<i', b'(3)<l', b'<i', b'<l']
E                    +  where b'>i' = <OpenGL.arrays._buffers.Py_buffer object at 0x3ff301e6dd0>.format
PyOpenGL-3.1.6/tests/test_arraydatatype.py:245: AssertionError
@mcfletch
Copy link
Owner

mcfletch commented Aug 8, 2023

Does indeed look wrong. I've updated the test to check the platform's byteorder and use the expected order in the assertions. Code updated in develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants