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'
I get the same message (although different stacktrace) with cymysql.