Skip to content

Commit

Permalink
Allow users to disable plugins using an environment variable (#40)
Browse files Browse the repository at this point in the history
* Allow users to disable plugins using an environment variable
  • Loading branch information
t-persson authored Apr 12, 2023
1 parent 3ece325 commit bf5dfd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

7 changes: 6 additions & 1 deletion src/etos_test_runner/etr.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ def _run_tests(self):

def load_plugins(self):
"""Load plugins from environment using the name etr_."""
disable_plugins = os.getenv("DISABLE_PLUGINS")
disabled_plugins = []
if disable_plugins:
disabled_plugins = disable_plugins.split(",")

discovered_plugins = {
name: importlib.import_module(name)
for _, name, _ in pkgutil.iter_modules()
if name.startswith("etr_")
if name.startswith("etr_") and name not in disabled_plugins
}
plugins = []
for name, module in discovered_plugins.items():
Expand Down

0 comments on commit bf5dfd4

Please sign in to comment.