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

Question:document for how to do pytest #108

Open
honglei opened this issue Apr 25, 2020 · 1 comment
Open

Question:document for how to do pytest #108

honglei opened this issue Apr 25, 2020 · 1 comment

Comments

@honglei
Copy link

honglei commented Apr 25, 2020

Env:CentOS8/ mosquitto 1.6.9

[root@localhost gmqtt-0.6.4]#  /opt/python38/bin/pytest
===================================================================================== test session starts =====================================================================================
platform linux -- Python 3.8.1, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /root/libs/gmqtt-0.6.4, inifile: pytest.ini
plugins: hypothesis-5.6.0, cov-2.8.1, forked-1.1.3, xdist-1.31.0, asyncio-0.11.0
collected 16 items

tests/test_mqtt5.py EEEEEEFEEEEEEEEE                                                                                                                                                    [100%]

=========================================================================================== ERRORS ============================================================================================
________________________________________________________________________________ ERROR at setup of test_basic _________________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
_________________________________________________________________________ ERROR at setup of test_basic_subscriptions __________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
___________________________________________________________________________ ERROR at setup of test_retained_message ___________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
_____________________________________________________________________________ ERROR at setup of test_will_message _____________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
_________________________________________________________________ ERROR at setup of test_no_will_message_on_gentle_disconnect _________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
_________________________________________________________________________ ERROR at setup of test_shared_subscriptions _________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
_____________________________________________________________________________ ERROR at setup of test_unsubscribe ______________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
______________________________________________________________________ ERROR at setup of test_overlapping_subscriptions _______________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
_______________________________________________________________________ ERROR at setup of test_redelivery_on_reconnect ________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
___________________________________________________________________________ ERROR at setup of test_async_on_message ___________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection
    connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive)
gmqtt/mqtt/connection.py:27: in create_connection
    transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
/opt/python38/lib/python3.8/asyncio/base_events.py:1021: in create_connection
    raise exceptions[0]
/opt/python38/lib/python3.8/asyncio/base_events.py:1006: in create_connection
    sock = await self._connect_sock(
/opt/python38/lib/python3.8/asyncio/base_events.py:920: in _connect_sock
    await self.sock_connect(sock, address)
/opt/python38/lib/python3.8/asyncio/selector_events.py:494: in sock_connect
    return await fut
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fut = <Future finished exception=ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 1883)")>
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>, address = ('127.0.0.1', 1883)

    def _sock_connect_cb(self, fut, sock, address):
        if fut.done():
            return

        try:
            err = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
            if err != 0:
                # Jump to any except clause below.
>               raise OSError(err, f'Connect call failed {address}')
E               ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1883)

/opt/python38/lib/python3.8/asyncio/selector_events.py:526: ConnectionRefusedError
------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------
clean up starting
___________________________________________________________________________ ERROR at setup of test_request_response ___________________________________________________________________________

    @pytest.fixture()
    async def init_clients():
>       await cleanup(host, port, username, prefix=PREFIX)

tests/test_mqtt5.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/utils.py:76: in cleanup
    await curclient.connect(host=host, port=port)
gmqtt/client.py:160: in connect
    self._connection = await self._create_connection(
gmqtt/client.py:177: in _create_connection

@Lenka42
Copy link
Collaborator

Lenka42 commented Apr 29, 2020

@honglei in order to run tests, you should set either TOKEN environment variable (in this case Flespi MQTT broker will be used) or the following set of env vars:
HOST (127.0.0.1 will be used if not provided), USERNAME, PASSWORD and PORT (1883 by default).

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