Skip to content

Commit

Permalink
Ignore exceptions that occur when we discover tests or nodedrivers, e…
Browse files Browse the repository at this point in the history
….g. Skip from pyunit tests that happen to be in the browsed directories (#339)

Co-authored-by: Johannes Ernst <git@j12t.org>
  • Loading branch information
jernst and Johannes Ernst authored Sep 18, 2024
1 parent be3fc1c commit 3a6a24b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/feditest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from urllib.parse import ParseResult, parse_qs, urlparse
from langcodes import Language

from feditest.reporting import trace

def _version(default_version="0.0.0"):
try:
return importlib.metadata.version("feditest")
Expand Down Expand Up @@ -177,7 +179,10 @@ def load_python_from(dirs: list[str], skip_init_files: bool) -> None:
if spec is not None and spec.loader is not None:
module = importlib.util.module_from_spec(spec)
sys.modules[module_name] = module
spec.loader.exec_module(module)
try :
spec.loader.exec_module(module)
except BaseException as e:
trace(f'Attempt to lead module { module_name } failed. Skipping.', e)
finally:
sys.path = sys_path_before

Expand Down

0 comments on commit 3a6a24b

Please sign in to comment.