Skip to content

Commit 7fb0b51

Browse files
committed
Code formatting
1 parent 7ddf6f0 commit 7fb0b51

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Import fixtures
44
from mqttwarn.testing.fixtures import mqttwarn_service as srv # noqa
55

6+
67
@pytest.fixture
78
def fake_filesystem(fs): # pylint:disable=invalid-name
89
try:

tests/services/test_file.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
import os
55
from unittest import mock
66

7-
import pytest as pytest
8-
97
import mqttwarn.services.file
8+
import pytest as pytest
109
from mqttwarn.model import ProcessorItem as Item
1110

1211

@@ -41,7 +40,10 @@ def test_file_success(fake_filesystem, srv, caplog, item):
4140

4241
assert outcome is True
4342
assert "Writing to file `/tmp/testdrive.log'" in caplog.messages
44-
assert open("/tmp/testdrive.log", mode="r", encoding="utf-8").read() == "\u26bd Notification message \u26bd"
43+
assert (
44+
open("/tmp/testdrive.log", mode="r", encoding="utf-8").read()
45+
== "\u26bd Notification message \u26bd"
46+
)
4547

4648

4749
@mock.patch("io.open", side_effect=Exception("something failed"))
@@ -66,10 +68,7 @@ def test_file_failure(fake_filesystem, srv, caplog):
6668
assert not os.path.exists("/tmp/testdrive.log")
6769

6870
assert outcome is False
69-
assert (
70-
"Cannot write to file `/tmp/testdrive.log': something failed"
71-
in caplog.messages
72-
)
71+
assert "Cannot write to file `/tmp/testdrive.log': something failed" in caplog.messages
7372

7473

7574
@pytest.mark.parametrize(
@@ -107,7 +106,10 @@ def test_file_append_newline_success(fake_filesystem, srv, caplog, item):
107106
assert outcome1 is True
108107
assert outcome2 is True
109108
assert "Writing to file `/tmp/testdrive.log'" in caplog.messages
110-
assert open("/tmp/testdrive.log", mode="r", encoding="utf-8").read() == "\u26bd Notification message \u26bd\n\u26bd Notification message \u26bd\n"
109+
assert (
110+
open("/tmp/testdrive.log", mode="r", encoding="utf-8").read()
111+
== "\u26bd Notification message \u26bd\n\u26bd Notification message \u26bd\n"
112+
)
111113

112114

113115
@pytest.mark.parametrize(
@@ -146,4 +148,7 @@ def test_file_overwrite_success(fake_filesystem, srv, caplog, item):
146148
assert outcome1 is True
147149
assert outcome2 is True
148150
assert "Writing to file `/tmp/testdrive.log'" in caplog.messages
149-
assert open("/tmp/testdrive.log", mode="r", encoding="utf-8").read() == "\u26bd Notification message \u26bd"
151+
assert (
152+
open("/tmp/testdrive.log", mode="r", encoding="utf-8").read()
153+
== "\u26bd Notification message \u26bd"
154+
)

tests/test_core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
configfile_service_loading,
1717
configfile_unknown_functions,
1818
)
19-
20-
2119
from tests.util import core_bootstrap, send_message
2220

2321

@@ -296,7 +294,8 @@ def inactive_test_status_publish(caplog):
296294
"""
297295

298296
from unittest import mock
299-
from unittest.mock import call, PropertyMock
297+
from unittest.mock import PropertyMock, call
298+
300299
from mqttwarn.core import connect
301300

302301
with caplog.at_level(logging.DEBUG):
@@ -311,4 +310,4 @@ def inactive_test_status_publish(caplog):
311310
outcome = connect().mqttc = mqtt_publish_mock
312311

313312
# Proof that the message has been routed to the "log" plugin properly
314-
#assert assertion here to verify the connection
313+
# assert assertion here to verify the connection

0 commit comments

Comments
 (0)