Skip to content

Commit

Permalink
Escape filenames which looks like regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBednarik authored and codingjoe committed Oct 24, 2019
1 parent b63fb2c commit c670676
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion relint.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def main():
paths = {
path
for file in args.files
for path in glob.iglob(file, recursive=True)
for path in glob.iglob(glob.escape(file), recursive=True)
}

tests = list(load_config(args.config))
Expand Down
5 changes: 3 additions & 2 deletions test_relint.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@


class TestMain:
def test_main_execution(self, mocker):
mocker.patch.object(sys, 'argv', ['relint.py', 'test_relint.py'])
@pytest.mark.parametrize('filename', ['test_relint.py', '[a-b].py', '[b-a].py'])
def test_main_execution(self, mocker, filename):
mocker.patch.object(sys, 'argv', ['relint.py', filename])

with pytest.raises(SystemExit) as exc_info:
main()
Expand Down

0 comments on commit c670676

Please sign in to comment.