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

test_buffer_numpy in zmq.tests.test_message.TestMessage fails #82

Closed
baloan opened this issue Mar 5, 2011 · 3 comments
Closed

test_buffer_numpy in zmq.tests.test_message.TestMessage fails #82

baloan opened this issue Mar 5, 2011 · 3 comments

Comments

@baloan
Copy link

baloan commented Mar 5, 2011

I have run the test suite after my build and encountered a failed test. What is the impact of the test failure?

Regards, Andreas

setup.py build_ext --inplace
setup.py test
...
======================================================================
FAIL: test_buffer_numpy (zmq.tests.test_message.TestMessage)
test non-copying numpy array messages
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\Dist\pyzmq-2.1.1\zmq\tests\test_message.py", line 264, in test_buffer_numpy
    self.assertEquals(A.data, m.buffer)
AssertionError: <read-write buffer for 0x0337CFC8, size 80, offset 0 at 0x03341140> != <memory at 0x010BDE40\>

----------------------------------------------------------------------
Ran 70 tests in 10.109s

FAILED (failures=1)

I am using:

  • zeromq-2.1.1
  • pymzq-2.1.1
  • Visual Studio 2008
  • Windows XP SP3

Compilation was successful. The I copied libzmq.dll to the PATH.

@minrk
Copy link
Member

minrk commented Mar 5, 2011

Crap, that's honestly probably just a bug in the test itself, due to the transition from buffer objects to memoryview objects in Python 2.7.

This test is for doing non-copying sends of data in numpy arrays.

numpy's A.data returns a buffer, while pyzmq uses memoryview objects in Python 2.7, and the two are not identical.

If you replace:
self.assertEquals(A.data, m.buffer)
B = numpy.frombuffer(m.buffer,dtype=A.dtype).reshape(A.shape)
with
self.assertEquals(memoryview(A), m.buffer)
B = numpy.array(m.buffer, dtype=A.dtype).reshape(A.shape)

and it passes, then there should be no problem.

Maybe we should not start using memoryviews until 3.0, though, and stick with buffers in 2.7.

@baloan
Copy link
Author

baloan commented Mar 5, 2011

All tests pass with proposed changes.

I leave the ticket open in case you want to follow up. Feel free to close otherwise.

@minrk
Copy link
Member

minrk commented Mar 5, 2011

fix non-copying numpy test for Python >= 2.7

closed by deab582

This issue was closed.
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