-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add globbing to codestyle_exclude #43
Conversation
This change will fix tests: diff --git a/test_pytest_codestyle.py b/test_pytest_codestyle.py
--- a/test_pytest_codestyle.py
+++ b/test_pytest_codestyle.py
@@ -46,9 +46,9 @@ def test_ini(testdir):
ignore = ['d', 'e', 'f']
assert config.getini('codestyle_ignore') == ignore
assert config.getini('codestyle_show_source') is True
- exclude = ['{dirname}/{base}/exclude.py', '{dirname}/{base}/path/to/another/exclude.py']
+ exclude = ['exclude.py', 'path/to/another/exclude.py']
assert config.getini('codestyle_exclude') == exclude
- """.format(dirname=testdir.tmpdir.dirname, base=testdir.tmpdir.basename))
+ """)
p = p.write(p.read() + "\n")
result = testdir.runpytest('--codestyle')
result.assert_outcomes(passed=2) This is because of |
And please update diff --git a/test_pytest_codestyle.py b/test_pytest_codestyle.py
--- a/test_pytest_codestyle.py
+++ b/test_pytest_codestyle.py
@@ -65,13 +65,14 @@ def test_pytest_collect_file(testdir):
def test_pytest_collect_file_with_exclude(testdir):
testdir.makeini("""
[pytest]
- codestyle_exclude = a.py path/to/c.py
+ codestyle_exclude = a.py path/**/?.py
""")
testdir.tmpdir.ensure('a.py')
testdir.tmpdir.ensure('b.py')
testdir.tmpdir.ensure('path/to/c.py')
+ testdir.tmpdir.ensure('path/to/hoge/foo.py')
result = testdir.runpytest('--codestyle')
- result.assert_outcomes(passed=1)
+ result.assert_outcomes(passed=2)
def test_cache(testdir): This will add a test case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f7a92db
to
de0a256
Compare
Sometimes a specific directory might include files that follow different style conventions (e.g., code generated using grpc) - before this change, any such files would need to be excluded individually. This commit makes specifying excluded files more flexible by allowing globbing in file paths. codestyle_exclude will now accept paths like `embedded_lib/**/*.py`, which will match any file in any subdirectory of `embedded_lib` that has a `.py` extension.
Thanks for the review @henry0312 - sorry it took me so long to respond as well ;) I've simply applied the changes you suggested, is that enough for a merge in your eyes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good work!
Will there be a new release for this change? |
I want to release a new version, but I've waited for #47. |
This "works", but it doesn't quite satisfy test cases. Since I'm not
sure what this test case wants to assert, I'm a little stuck here.