From ac13a1ac80182f0ccec87c7912ea9f4ebc7c4777 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Fri, 19 Jan 2024 09:37:49 +0100 Subject: [PATCH] add debug logging if locust-plugins was not found --- locust_swarm/swarm.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locust_swarm/swarm.py b/locust_swarm/swarm.py index beff235..47b6e3f 100644 --- a/locust_swarm/swarm.py +++ b/locust_swarm/swarm.py @@ -1,9 +1,3 @@ -try: - import svs_locust -except ModuleNotFoundError: - # svs-locust is a library that is only used internally at Svenska Spel, please ignore it - # We need to import it here to get some variables and the path to the installed package - pass import atexit import logging import os @@ -254,12 +248,18 @@ def upload(server): import locust_plugins files.append(os.path.dirname(locust_plugins.__file__)) - try: - files.append(os.path.dirname(svs_locust.__file__)) - except NameError: - pass - except ImportError: - pass # locust-plugins wasnt installed + except ModuleNotFoundError: + logging.debug("locust-plugins wasnt installed") + + try: + # svs-locust is a library that is only used internally at Svenska Spel, please ignore it + + import svs_locust + + files.append(os.path.dirname(svs_locust.__file__)) + except ModuleNotFoundError: + pass + if len(files) > 1: filestr = "{" + ",".join(files) + "}" else: