diff --git a/tests/test_entrypoints.py b/tests/test_entrypoints.py
new file mode 100644
index 0000000..0b87e6d
--- /dev/null
+++ b/tests/test_entrypoints.py
@@ -0,0 +1,99 @@
+from test_base import CfgCheckerTestBase
+
+
+class TestEntrypoints(CfgCheckerTestBase):
+    def test_entry_mcp_checker(self):
+        _module_name = 'cfg_checker.cfg_check'
+        with self.redirect_output():
+            _msg, _m = self._safe_import_module(_module_name)
+
+        self.assertEqual(
+            len(_msg),
+            0,
+            "Error importing '{}': {}".format(
+                _module_name,
+                _msg
+            )
+        )
+
+        with self.redirect_output():
+            with self.assertRaises(SystemExit) as ep:
+                _m.cfg_check.config_check_entrypoint()
+
+        self.assertEqual(
+            ep.exception.code,
+            0,
+            "mcp-checker has non-zero exit-code"
+        )
+
+    def test_entry_packages(self):
+        _module_name = 'cfg_checker.cli.package'
+        with self.redirect_output():
+            _msg, _m = self._safe_import_module(_module_name)
+
+        self.assertEqual(
+            len(_msg),
+            0,
+            "Error importing '{}': {}".format(
+                _module_name,
+                _msg
+            )
+        )
+
+        with self.redirect_output():
+            with self.assertRaises(SystemExit) as ep:
+                _m.cli.package.cli_package()
+
+        self.assertEqual(
+            ep.exception.code,
+            0,
+            "packages has non-zero exit code"
+        )
+
+    def test_entry_network(self):
+        _module_name = 'cfg_checker.cli.network'
+        with self.redirect_output():
+            _msg, _m = self._safe_import_module(_module_name)
+
+        self.assertEqual(
+            len(_msg),
+            0,
+            "Error importing '{}': {}".format(
+                _module_name,
+                _msg
+            )
+        )
+
+        with self.redirect_output():
+            with self.assertRaises(SystemExit) as ep:
+                _m.cli.network.cli_network()
+
+        self.assertEqual(
+            ep.exception.code,
+            0,
+            "network has non-zero exit-code"
+        )
+
+    def test_entry_reclass(self):
+        _module_name = 'cfg_checker.cli.reclass'
+        with self.redirect_output():
+            _msg, _m = self._safe_import_module(_module_name)
+
+        self.assertEqual(
+            len(_msg),
+            0,
+            "Error importing '{}': {}".format(
+                _module_name,
+                _msg
+            )
+        )
+
+        with self.redirect_output():
+            with self.assertRaises(SystemExit) as ep:
+                _m.cli.reclass.cli_reclass()
+
+        self.assertEqual(
+            ep.exception.code,
+            0,
+            "reclass has non-zero exit-code"
+        )
