Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
justmobilize committed Feb 27, 2024
1 parent f1222a2 commit 1f0c0c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/test_backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

"""exponential back-off tests"""

import pytest

import socket
import ssl
import time
from unittest.mock import call, patch

import pytest
import adafruit_minimqtt.adafruit_minimqtt as MQTT


Expand Down
4 changes: 3 additions & 1 deletion tests/test_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

"""loop() tests"""

import pytest
import random
import socket
import ssl
Expand All @@ -14,6 +13,7 @@
from unittest.mock import patch
from unittest import mock

import pytest
import adafruit_minimqtt.adafruit_minimqtt as MQTT


Expand Down Expand Up @@ -158,6 +158,7 @@ def test_loop_basic(self) -> None:
assert ret_code == expected_rc
expected_rc += 1

# pylint: disable=no-self-use
# pylint: disable=invalid-name
def test_loop_timeout_vs_socket_timeout(self):
"""
Expand All @@ -178,6 +179,7 @@ def test_loop_timeout_vs_socket_timeout(self):

assert "loop timeout" in str(context)

# pylint: disable=no-self-use
def test_loop_is_connected(self):
"""
loop() should throw MMQTTException if not connected
Expand Down
6 changes: 5 additions & 1 deletion tests/test_port_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

"""tests that verify the connect behavior w.r.t. port number and TLS"""

import pytest
import socket
import ssl
from unittest.mock import Mock, call, patch

import pytest
import adafruit_minimqtt.adafruit_minimqtt as MQTT


Expand All @@ -17,6 +17,7 @@ class TestPortSslSetup:
These tests assume that there is no MQTT broker running on the hosts/ports they connect to.
"""

# pylint: disable=no-self-use
def test_default_port(self) -> None:
"""verify default port value and that TLS is not used"""
host = "127.0.0.1"
Expand Down Expand Up @@ -44,6 +45,7 @@ def test_default_port(self) -> None:
# Assuming the repeated calls will have the same arguments.
connect_mock.assert_has_calls([call((host, expected_port))])

# pylint: disable=no-self-use
def test_connect_override(self):
"""Test that connect() can override host and port."""
host = "127.0.0.1"
Expand All @@ -69,6 +71,7 @@ def test_connect_override(self):
# Assuming the repeated calls will have the same arguments.
connect_mock.assert_has_calls([call((expected_host, expected_port))])

# pylint: disable=no-self-use
@pytest.mark.parametrize("port", (None, 8883))
def test_tls_port(self, port) -> None:
"""verify that when is_ssl=True is set, the default port is 8883
Expand Down Expand Up @@ -104,6 +107,7 @@ def test_tls_port(self, port) -> None:
# Assuming the repeated calls will have the same arguments.
connect_mock.assert_has_calls([call((host, expected_port))])

# pylint: disable=no-self-use
def test_tls_without_ssl_context(self) -> None:
"""verify that when is_ssl=True is set, the code will check that ssl_context is not None"""
host = "127.0.0.1"
Expand Down

0 comments on commit 1f0c0c7

Please sign in to comment.