From d5136bd3c77b30fb185729a26ba9969e4d46a575 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Wed, 14 Dec 2022 13:24:17 +0100 Subject: [PATCH] allow --disable-plugins params to match at end of string --- har2locust/__main__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/har2locust/__main__.py b/har2locust/__main__.py index 8f81da7..3c0d38b 100644 --- a/har2locust/__main__.py +++ b/har2locust/__main__.py @@ -37,13 +37,14 @@ def load_plugins(plugins: list[str] = [], disable_plugins: list[str] = []): default_and_extra_plugins = default_plugins + plugins plugins_copy = default_and_extra_plugins.copy() - for p in disable_plugins: - try: - default_and_extra_plugins.remove(p) - logging.debug("Disabled plugin: " + p) - except ValueError: - logging.error(f"Tried to disable unknown plugin: {p}. Known plugins are {plugins_copy}") - raise + for dp in disable_plugins: + for p in default_and_extra_plugins[:]: + if p.endswith(dp): + default_and_extra_plugins.remove(p) + logging.debug("Disabled plugin: " + p) + break + else: + raise Exception(f"Tried to disable unknown plugin: {dp}. Known plugins are {plugins_copy}") sys.path.append(os.path.curdir) # accept plugins by relative path for plugin in default_and_extra_plugins: