From 90388d2800f5f92f6d87f22e80766d88c3afb681 Mon Sep 17 00:00:00 2001 From: Timothy Allen Date: Wed, 7 Oct 2026 17:40:15 +0200 Subject: [PATCH] Stop Prometheus mode from falling through to the client --- bmspy/__init__.py | 2 +- tests/test_init.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bmspy/__init__.py b/bmspy/__init__.py index aca74e2..f874e50 100644 --- a/bmspy/__init__.py +++ b/bmspy/__init__.py @@ -138,7 +138,7 @@ def main() -> None: prometheus.prometheus_export(daemonize=True, debug=debug) - if args.report_influxdb: + elif args.report_influxdb: from bmspy import influxdb as bms_influx bms_influx.influxdb_export( diff --git a/tests/test_init.py b/tests/test_init.py index 71e38bb..c02e699 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -138,9 +138,13 @@ class TestMain: import bmspy.prometheus as prom_mod mock_export = MagicMock() with patch("sys.argv", ["bmspy", "--prometheus"]), \ - patch.object(prom_mod, "prometheus_export", mock_export): + patch.object(prom_mod, "prometheus_export", mock_export), \ + patch("bmspy.client.handle_registration") as register, \ + patch("bmspy.client.read_data") as read_data: main() mock_export.assert_called_once() + register.assert_not_called() + read_data.assert_not_called() def test_textfile_flag_calls_prometheus_export(self, tmp_path): import bmspy.prometheus as prom_mod