diff --git a/swh/scanner/cli.py b/swh/scanner/cli.py --- a/swh/scanner/cli.py +++ b/swh/scanner/cli.py @@ -49,9 +49,8 @@ ) raise InvalidDirectoryPath(error_msg) - if glob.glob(pattern): - regex = fnmatch.translate(str(PosixPath(pattern))) - yield re.compile(regex) + regex = fnmatch.translate(str(PosixPath(pattern))) + yield re.compile(regex) @scanner.command(name="scan") diff --git a/swh/scanner/tests/test_cli.py b/swh/scanner/tests/test_cli.py --- a/swh/scanner/tests/test_cli.py +++ b/swh/scanner/tests/test_cli.py @@ -9,7 +9,7 @@ patterns = (str(temp_folder["subdir"]), "/none") sre_patterns = [reg_obj for reg_obj in extract_regex_objs(root_path, patterns)] - assert len(sre_patterns) == 1 + assert len(sre_patterns) == 2 patterns = (*patterns, "/tmp") with pytest.raises(InvalidDirectoryPath):