parent
914b6247e4
commit
f55d5ffd8c
@ -193,7 +193,10 @@ class IResolver:
|
|||||||
:return: List of dicts containing 'name', 'class' and 'location' entries
|
:return: List of dicts containing 'name', 'class' and 'location' entries
|
||||||
"""
|
"""
|
||||||
logger.debug(f"Searching for {cls.object_type.__name__} '{directory}'")
|
logger.debug(f"Searching for {cls.object_type.__name__} '{directory}'")
|
||||||
objects = []
|
objects: List[Dict[str, Any]] = []
|
||||||
|
if not directory.is_dir():
|
||||||
|
logger.info(f"'{directory}' is not a directory, skipping.")
|
||||||
|
return objects
|
||||||
for entry in directory.iterdir():
|
for entry in directory.iterdir():
|
||||||
if (
|
if (
|
||||||
recursive and entry.is_dir()
|
recursive and entry.is_dir()
|
||||||
|
@ -48,6 +48,10 @@ def test_search_all_strategies_with_failed():
|
|||||||
assert len([x for x in strategies if x['class'] is not None]) == 9
|
assert len([x for x in strategies if x['class'] is not None]) == 9
|
||||||
assert len([x for x in strategies if x['class'] is None]) == 1
|
assert len([x for x in strategies if x['class'] is None]) == 1
|
||||||
|
|
||||||
|
directory = Path(__file__).parent / "strats_nonexistingdir"
|
||||||
|
strategies = StrategyResolver.search_all_objects(directory, enum_failed=True)
|
||||||
|
assert len(strategies) == 0
|
||||||
|
|
||||||
|
|
||||||
def test_load_strategy(default_conf, result):
|
def test_load_strategy(default_conf, result):
|
||||||
default_conf.update({'strategy': 'SampleStrategy',
|
default_conf.update({'strategy': 'SampleStrategy',
|
||||||
|
Loading…
Reference in New Issue
Block a user