Skip to content

Commit

Permalink
allow --disable-plugins params to match at end of string
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Dec 14, 2022
1 parent d50f347 commit d5136bd
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions har2locust/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d5136bd

Please sign in to comment.