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

RuntimeError: HTTPretty intercepted and unexpected socket method call. (amqp/pika/rabbitmq) #92

Open
aaltepet opened this issue Aug 20, 2013 · 1 comment

Comments

@aaltepet
Copy link

httpretty instructed me to report a bug.

Try this simple script:

import pika
import httpretty

@httpretty.activate
def test_me():
        parameters = pika.URLParameters('amqp://guest:guest@localhost:5672/%2F')
        connection = pika.BlockingConnection(parameters)
        channel = connection.channel()
        channel.exchange_declare(exchange='e', durable=True, type='direct')
        channel.queue_declare(queue='q', durable=True, exclusive=False,
                              auto_delete=False)
        channel.queue_bind(exchange='e', queue='q', routing_key='q')
        channel.close()
        connection.close()

test_me()

returns the following traceback:

[' File "", line 1, in \n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/httpretty-0.6.3-py2.7.egg/httpretty/core.py", line 807, in wrapper\n return test(_args, *_kw)\n', ' File "", line 4, in test_me\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/adapters/base_connection.py", line 61, in init\n super(BaseConnection, self).init(parameters, on_open_callback)\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/connection.py", line 513, in init\n self._connect()\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/connection.py", line 809, in _connect\n self._adapter_connect()\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/adapters/blocking_connection.py", line 186, in _adapter_connect\n self._on_connected()\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/connection.py", line 1041, in _on_connected\n self._send_frame(frame.ProtocolHeader())\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/adapters/blocking_connection.py", line 294, in _send_frame\n super(BlockingConnection, self)._send_frame(frame_value)\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/connection.py", line 1326, in _send_frame\n self._flush_outbound()\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/adapters/blocking_connection.py", line 253, in _flush_outbound\n if self._handle_write():\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/pika-0.9.9-py2.7.egg/pika/adapters/base_connection.py", line 315, in _handle_write\n bytes_written = self.socket.send(self.outbound_buffer.read())\n', ' File "/home/andy/flywheel/buildout-scripzo-backend/eggs/httpretty-0.6.3-py2.7.egg/httpretty/core.py", line 299, in debug\n lines = map(utf8, traceback.format_stack(frame))\n']

On line 315 of pika.base_connection.BaseConnection:
bytes_written = self.socket.send(self.outbound_buffer.read())

The value of self.outbound_buffer.read() is:
'AMQP\x00\x00\t\x01'

@taybin
Copy link

taybin commented Sep 7, 2013

I get the same message (although different stacktrace) with cymysql.

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