Skip to content

Commit

Permalink
Trasnfer code from fmf_metadata directly to FMF
Browse files Browse the repository at this point in the history
  • Loading branch information
jscotka committed May 24, 2021
1 parent b09ae2f commit 02ce718
Show file tree
Hide file tree
Showing 10 changed files with 604 additions and 115 deletions.
15 changes: 9 additions & 6 deletions fmf/plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ def enabled_plugins():
plugins = os.getenv(PLUGIN_ENV).split(",") if os.getenv(PLUGIN_ENV) else []
plugin_list = list()
for item in plugins:
loader = importlib.machinery.SourceFileLoader(
os.path.basename(item), item)
module = importlib.util.module_from_spec(
importlib.util.spec_from_loader(loader.name, loader)
)
loader.exec_module(module)
if os.path.exists(item):
loader = importlib.machinery.SourceFileLoader(
os.path.basename(item), item)
module = importlib.util.module_from_spec(
importlib.util.spec_from_loader(loader.name, loader)
)
loader.exec_module(module)
else:
module = importlib.import_module(item)
for name, plugin in inspect.getmembers(module):
if inspect.isclass(plugin) and plugin != Plugin and issubclass(
plugin, Plugin):
Expand Down
Empty file added fmf/plugins/__init__.py
Empty file.
98 changes: 0 additions & 98 deletions fmf/plugins/pytest.py

This file was deleted.

2 changes: 2 additions & 0 deletions fmf/plugins/pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from fmf.plugins.pytest.tmt_semantic import TMT
from fmf.plugins.pytest.plugin import Pytest
13 changes: 13 additions & 0 deletions fmf/plugins/pytest/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CONFIG_POSTPROCESSING_TEST = "test_postprocessing"
PYTEST_DEFAULT_CONF = {
CONFIG_POSTPROCESSING_TEST: {
"test": """
cls_str = ("::" + str(cls.name)) if cls.name else ""
escaped = shlex.quote(f"{filename}{cls_str}::{test.name}")
f"python3 -m pytest -m '' -v {escaped}" """
}
}
CONFIG_MERGE_PLUS = "merge_plus"
CONFIG_MERGE_MINUS = "merge_minus"
CONFIG_ADDITIONAL_KEY = "additional_keys"
CONFIG_POSTPROCESSING_TEST = "test_postprocessing"
Loading

0 comments on commit 02ce718

Please sign in to comment.