-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow patterns for INCLUDE/EXCLUDE from py3.13 onwards (#73)
* Refactor Filter to allow patterns for INCLUDE/EXCLUDE from py3.13 onwards * Add pytest to CI
- Loading branch information
1 parent
559898c
commit bb77fc4
Showing
3 changed files
with
99 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,16 @@ jobs: | |
- name: Run NSIQCppStyle App tests | ||
timeout-minutes: 5 | ||
run: python nsiqcppstyle_exe.py -f nsiqunittest/rules/comment_and_empty_lines.txt --ci nsiqunittest/src/simple_main.cpp | ||
|
||
run-pytest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.13 # any python is ok | ||
- name: Install Hatch | ||
run: pipx install hatch | ||
- name: Run pytest | ||
run: hatch run test:test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import sys | ||
|
||
import pytest | ||
|
||
from nsiqcppstyle_exe import Filter | ||
|
||
|
||
@pytest.fixture | ||
def simple_filter(): | ||
return Filter("simple_test", {}, {}) | ||
|
||
|
||
@pytest.mark.skipif(sys.version_info < (3, 13), reason="Needs new glob features from 3.13") | ||
def test_non_recursive_exclude(simple_filter: Filter): | ||
simple_filter.AddExclude("*.py") | ||
assert not simple_filter.CheckFileInclusion("hello.py") | ||
assert simple_filter.CheckFileInclusion("SomeDir/hello.py") | ||
|
||
|
||
@pytest.mark.skipif(sys.version_info < (3, 13), reason="Needs new glob features from 3.13") | ||
def test_recursive_exclude(simple_filter: Filter): | ||
simple_filter.AddExclude("**/*.py") | ||
assert not simple_filter.CheckFileInclusion("hello.py") | ||
assert not simple_filter.CheckFileInclusion("SomeDir/hello.py") | ||
|
||
|
||
def test_prefix_match(simple_filter: Filter): | ||
simple_filter.AddExclude("test/") | ||
assert simple_filter.CheckFileInclusion("test.py") | ||
assert not simple_filter.CheckFileInclusion("test/test.py") | ||
assert not simple_filter.CheckFileInclusion("test/hello.py") | ||
|
||
simple_filter.AddInclude("test/test") | ||
assert simple_filter.CheckFileInclusion("test/test.py") | ||
assert not simple_filter.CheckFileInclusion("test/hello.py") |