Skip to content

Commit

Permalink
fix pathspec update (#10)
Browse files Browse the repository at this point in the history
* fix pathspec update

* update test versions

* update tests
  • Loading branch information
lime-green authored Jan 1, 2023
1 parent 3ea8e70 commit feba2ae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: '${{ matrix.python-version }}'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules"
],
Expand Down
1 change: 1 addition & 0 deletions src/unison_gitignore/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ def __str__(self):
.replace("\\-", "-")
.replace("\\#", "#")
.replace("\\ ", " ")
.replace("(?P<ps_d>/)", "/")
)
return f"{s}=Regex {escaped_regex}"
4 changes: 2 additions & 2 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_wildcard_and_negation_regex(mock_path):
parsed = GitIgnoreToUnisonIgnore(mock_path).parse_gitignore(StringIO(contents))
assert len(parsed) == 2
assert str(parsed[0]) == r"-ignore=Regex ^home/john_doe/(.+/)?[^/]*\.py[co](/.*)?$"
assert str(parsed[1]) == r"-ignorenot=Regex ^home/john_doe/(.+/)?test\.pyc$"
assert str(parsed[1]) == r"-ignorenot=Regex ^home/john_doe/(.+/)?test\.pyc(/.*)?$"


def test_directories_regex(mock_path):
Expand All @@ -78,7 +78,7 @@ def test_directories_regex(mock_path):
"""
parsed = GitIgnoreToUnisonIgnore(mock_path).parse_gitignore(StringIO(contents))
assert len(parsed) == 3
assert str(parsed[0]) == r"-ignore=Regex ^home/john_doe/(.+/)?abc$"
assert str(parsed[0]) == r"-ignore=Regex ^home/john_doe/(.+/)?abc/.*$"
assert str(parsed[1]) == r"-ignore=Regex ^home/john_doe/(.+/)?x/y(/.*)?$"
assert str(parsed[2]) == r"-ignore=Regex ^home/john_doe/b(/.+)?/c/d(/.*)?$"

Expand Down

0 comments on commit feba2ae

Please sign in to comment.