def test_list_python_files_exclude_file_wildcard(mocker): walk = mocker.patch("os.walk") walk.return_value = [ (".", ["a"], ["b.txt", "c.py"]), ("a", [], ["d.txt", "e.py"]), ] assert list(grep.list_python_files("f", exclude=["a/*.py"])) == ["c.py"]
def test_list_python_files(mocker): walk = mocker.patch("os.walk") walk.return_value = [ (".", ["a"], ["b.txt", "c.py"]), ("a", [], ["d.txt", "e.py"]), ] assert list(grep.list_python_files("f")) == ["c.py", "a/e.py"]
def test_list_python_files_exclude_multiple(mocker): walk = mocker.patch("os.walk") dirs = ["a", "b"] walk.return_value = [ (".", dirs, ["b.txt", "c.py"]), ("a", [], ["d.txt", "e.py"]), ] assert list(grep.list_python_files("f", exclude=["b", "a/*"])) == ["c.py"] assert dirs == ["a"]