Skip to content

Commit

Permalink
fix(globbing): escape expected corrected string for regex matching
Browse files Browse the repository at this point in the history
  • Loading branch information
conradsoon committed Oct 23, 2024
1 parent 37b91dd commit b1202eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/io/test_list_files_local.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
import re

import pytest
from fsspec.implementations.local import LocalFileSystem
Expand Down Expand Up @@ -169,7 +170,6 @@ def test_missing_file_path(tmp_path, include_protocol):


@pytest.mark.parametrize("include_protocol", [False, True])
@pytest.mark.integration()
def test_invalid_double_asterisk_usage_local(tmp_path, include_protocol):
d = tmp_path / "dir"
d.mkdir()
Expand All @@ -182,6 +182,9 @@ def test_invalid_double_asterisk_usage_local(tmp_path, include_protocol):
if include_protocol:
expected_correct_path = "file://" + expected_correct_path

# Need to escape these or the regex matcher will complain
expected_correct_path = re.escape(expected_correct_path)

with pytest.raises(DaftCoreException, match=expected_correct_path):
io_glob(path)

Expand Down

0 comments on commit b1202eb

Please sign in to comment.