Browse Source

fix console entry point

bug introduced in commit 2468700b4aa7fcc2dccddc03b4e55a6ba35815f7
Fabian Peter Hammerle 2 years ago
parent
commit
71dd59b114
2 changed files with 8 additions and 1 deletions
  1. 1 1
      setup.py
  2. 7 0
      tests/test_cli.py

+ 1 - 1
setup.py

@@ -72,7 +72,7 @@ setuptools.setup(
         "Programming Language :: Python :: 3.10",
         "Topic :: Home Automation",
     ],
-    entry_points={"console_scripts": ["switchbot-mqtt = switchbot_mqtt:_main"]},
+    entry_points={"console_scripts": ["switchbot-mqtt = switchbot_mqtt._cli:_main"]},
     # variable type hints, f-strings & * to force keyword-only arguments
     python_requires=">=3.6",
     install_requires=[

+ 7 - 0
tests/test_cli.py

@@ -18,6 +18,7 @@
 
 import json
 import logging
+import subprocess
 import typing
 import unittest.mock
 
@@ -30,6 +31,12 @@ import switchbot_mqtt._cli
 # pylint: disable=too-many-arguments; these are tests, no API
 
 
+def test_console_entry_point():
+    assert subprocess.run(
+        ["switchbot-mqtt", "--help"], stdout=subprocess.PIPE, check=True
+    ).stdout.startswith(b"usage: ")
+
+
 @pytest.mark.parametrize(
     (
         "argv",