Browse Source

upgrade black

Fabian Peter Hammerle 3 years ago
parent
commit
3d38cf6028
6 changed files with 20 additions and 13 deletions
  1. 1 1
      Pipfile
  2. 3 4
      Pipfile.lock
  3. 5 1
      setup.py
  4. 7 3
      tests/test_cli.py
  5. 2 2
      tests/test_dbus.py
  6. 2 2
      tests/test_state_dbus.py

+ 1 - 1
Pipfile

@@ -14,7 +14,7 @@ pycairo = "<1.20"
 [dev-packages]
 # black requires python>=3.6
 # https://github.com/psf/black/commit/e74117f172e29e8a980e2c9de929ad50d3769150#diff-2eeaed663bd0d25b7e608891384b7298R51
-black = {version = "==19.10b0", markers = "python_version >= '3.6'"}
+black = {version = "==20.8b1", markers = "python_version >= '3.6'"}
 mypy = "*"
 pylint = "*"
 # >=2.0.3 to skip PyGObject's custom loader & fix broken wheel

+ 3 - 4
Pipfile.lock

@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "8d2b67b344c0d033e1d1b212398e992c0b142dc47e453638c53f2670dfe4ce92"
+            "sha256": "23f9685145ed5be53bf0b00fbf3eacd39a9c09d1fba0cc9aed5f123c161f187d"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -70,12 +70,11 @@
         },
         "black": {
             "hashes": [
-                "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b",
-                "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"
+                "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"
             ],
             "index": "pypi",
             "markers": "python_version >= '3.6'",
-            "version": "==19.10b0"
+            "version": "==20.8b1"
         },
         "click": {
             "hashes": [

+ 5 - 1
setup.py

@@ -61,7 +61,11 @@ setuptools.setup(
         "Programming Language :: Python :: 3.8",
         "Topic :: Home Automation",
     ],
-    entry_points={"console_scripts": ["systemctl-mqtt = systemctl_mqtt:_main",]},
+    entry_points={
+        "console_scripts": [
+            "systemctl-mqtt = systemctl_mqtt:_main",
+        ]
+    },
     # https://dbus.freedesktop.org/doc/dbus-python/news.html
     install_requires=["PyGObject<4", "dbus-python<2", "paho-mqtt<2"],
     setup_requires=["setuptools_scm"],

+ 7 - 3
tests/test_cli.py

@@ -255,13 +255,16 @@ def test__main_homeassistant_discovery_prefix(args, discovery_prefix):
 
 @pytest.mark.parametrize(
     ("args", "node_id"),
-    [([], "fallback"), (["--homeassistant-node-id", "raspberrypi"], "raspberrypi"),],
+    [
+        ([], "fallback"),
+        (["--homeassistant-node-id", "raspberrypi"], "raspberrypi"),
+    ],
 )
 def test__main_homeassistant_node_id(args, node_id):
     with unittest.mock.patch("systemctl_mqtt._run") as run_mock, unittest.mock.patch(
         "sys.argv", ["", "--mqtt-host", "mqtt-broker.local"] + args
     ), unittest.mock.patch(
-        "systemctl_mqtt._utils.get_hostname", return_value="fallback",
+        "systemctl_mqtt._utils.get_hostname", return_value="fallback"
     ):
         systemctl_mqtt._main()
     assert run_mock.call_count == 1
@@ -269,7 +272,8 @@ def test__main_homeassistant_node_id(args, node_id):
 
 
 @pytest.mark.parametrize(
-    "args", [["--homeassistant-node-id", "no pe"], ["--homeassistant-node-id", ""]],
+    "args",
+    [["--homeassistant-node-id", "no pe"], ["--homeassistant-node-id", ""]],
 )
 def test__main_homeassistant_node_id_invalid(args):
     with unittest.mock.patch(

+ 2 - 2
tests/test_dbus.py

@@ -102,7 +102,7 @@ def test__log_shutdown_inhibitors_fail(caplog):
 def test__schedule_shutdown(action, delay):
     login_manager_mock = unittest.mock.MagicMock()
     with unittest.mock.patch(
-        "systemctl_mqtt._dbus.get_login_manager", return_value=login_manager_mock,
+        "systemctl_mqtt._dbus.get_login_manager", return_value=login_manager_mock
     ):
         systemctl_mqtt._dbus.schedule_shutdown(action=action, delay=delay)
     assert login_manager_mock.ScheduleShutdown.call_count == 1
@@ -135,7 +135,7 @@ def test__schedule_shutdown_fail(caplog, action, exception_message, log_message)
         exception_message
     )
     with unittest.mock.patch(
-        "systemctl_mqtt._dbus.get_login_manager", return_value=login_manager_mock,
+        "systemctl_mqtt._dbus.get_login_manager", return_value=login_manager_mock
     ), caplog.at_level(logging.DEBUG):
         systemctl_mqtt._dbus.schedule_shutdown(
             action=action, delay=datetime.timedelta(seconds=21)

+ 2 - 2
tests/test_state_dbus.py

@@ -40,7 +40,7 @@ def test_shutdown_lock():
         state._login_manager.Inhibit.return_value = lock_fd
         state.acquire_shutdown_lock()
     state._login_manager.Inhibit.assert_called_once_with(
-        "shutdown", "systemctl-mqtt", "Report shutdown via MQTT", "delay",
+        "shutdown", "systemctl-mqtt", "Report shutdown via MQTT", "delay"
     )
     assert state._shutdown_lock == lock_fd
     # https://dbus.freedesktop.org/doc/dbus-python/dbus.types.html#dbus.types.UnixFd.take
@@ -146,7 +146,7 @@ def test_publish_preparing_for_shutdown_get_fail(caplog):
 @pytest.mark.parametrize("node_id", ["node", "node-id"])
 @pytest.mark.parametrize("hostname", ["hostname", "host-name"])
 def test_publish_preparing_for_shutdown_homeassistant_config(
-    topic_prefix, discovery_prefix, node_id, hostname,
+    topic_prefix, discovery_prefix, node_id, hostname
 ):
     state = systemctl_mqtt._State(
         mqtt_topic_prefix=topic_prefix,