Skip to content

Commit

Permalink
Merge pull request #241 from ivandasch/python3-module-import-error
Browse files Browse the repository at this point in the history
Fix python3 annoying false positive import error.
  • Loading branch information
andrewegel committed Aug 13, 2020
2 parents 23bd5ab + c1baba0 commit bfe5371
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ducktape/tests/loader.py
Expand Up @@ -273,12 +273,12 @@ def _import_module(self, file_path):
# import line), or a SyntaxError.
expected_error = False
if isinstance(e, ImportError):
match = re.search(r"No module named ([^\s]+)", str(e))
match = re.search(r"No module named '?([^\s\']+)'?", str(e))

if match is not None:
missing_module = match.groups()[0]

if missing_module == module_name:
if missing_module in module_name:
expected_error = True
else:
# The error is still an expected error if missing_module is a suffix of module_name.
Expand Down

0 comments on commit bfe5371

Please sign in to comment.