Skip to content

Regression

OmeroPy.test.integration.scriptstest.test_script_utils.TestScriptUtils.test_upload_plane (from pytest)

Failing for the past 1 build (Since #412 )
Took 2.4 sec.

Error Message

AttributeError: 'numpy.ndarray' object has no attribute 'tostring'

Stacktrace

self = <test.integration.scriptstest.test_script_utils.TestScriptUtils object at 0x7fdffd2215d0>

    def test_upload_plane(self):
        """Test the upload of the plane."""
        client = self.new_client()
        # create an image
        channel_list = list(range(2))
        session = client.getSession()
        pixels_service = session.getPixelsService()
        query_service = session.getQueryService()
    
        def f1(x, y):
            return y
    
        def f2(x, y):
            return (x + y) // 2
    
        def f3(x, y):
            return x
    
        p_type = PixelsTypeint16
        pixels_type = query_service.findByQuery(
            "from PixelsType as p where p.value='%s'" % p_type, None)
        iid = pixels_service.createImage(100, 100, 1, 1, channel_list,
                                         pixels_type,
                                         "uploaded_image", "test")
        id = iid.getValue()
        query_string = "select p from Pixels p join fetch p.image " \
                       "as i join fetch p.pixelsType where i.id='%s'" % id
        pixels = query_service.findByQuery(query_string, None)
        store = client.sf.createRawPixelsStore()
        try:
            store.setPixelsId(pixels.getId().getValue(), True)
            f_list = [f1, f2, f3]
            for the_c in range(len(channel_list)):
                f = f_list[the_c % len(f_list)]
                plane = fromfunction(f, (100, 100), dtype=int16)
>               scriptUtil.upload_plane(store, plane, 0, the_c, 0)

test/integration/scriptstest/test_script_utils.py:306: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

raw_pixels_store = dfeab2e3-846e-4b41-bb1f-5a172020c268/e7536f46-4a5d-4a88-95c6-a5df5776b5ddomero.api.RawPixelsStore -t -e 1.1:tcp -h 172.18.0.11 -p 36999 -t 60000
plane = array([[ 0,  1,  2, ..., 97, 98, 99],
       [ 0,  1,  2, ..., 97, 98, 99],
       [ 0,  1,  2, ..., 97, 98, 99],
    ...7, 98, 99],
       [ 0,  1,  2, ..., 97, 98, 99],
       [ 0,  1,  2, ..., 97, 98, 99]], shape=(100, 100), dtype=int16)
z = 0, c = 0, t = 0

    def upload_plane(raw_pixels_store, plane, z, c, t):
        """
        Upload the plane to the server attaching it to the current z,c,t
        of the already instantiated rawPixelStore.
    
        :param raw_pixels_store store pointing to the data.
        :param plane The data to upload
        :param z The Z-Section of the plane.
        :param c The C-Section of the plane.
        :param t The T-Section of the plane.
        """
        byte_swapped_plane = plane.byteswap()
>       converted_plane = byte_swapped_plane.tostring()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AttributeError: 'numpy.ndarray' object has no attribute 'tostring'

../../../../.venv3/lib64/python3.11/site-packages/omero/util/script_utils.py:1088: AttributeError