-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
One-liner in bandit config to skip B101 assert_used in files matching a filter #346
Closed
Labels
enhancement
New feature or request
Milestone
Comments
aqw
added a commit
to pigskin/pigskin
that referenced
this issue
Oct 2, 2018
This, unfortunately, skips the test for all files. Upstream has a feature request for disabling tests for only certain files/folders. PyCQA/bandit#346
Does #450 satisfy this feature request? |
This was referenced Apr 30, 2020
Does this not work anymore? |
wilbertom
added a commit
to wilbertom/bandit
that referenced
this issue
Aug 12, 2020
Adding this configuration allows the user to skip the assert_used against some files. This is useful because asserts are very common in test files when using pytest. Specifying this configuration: ``` assert_used: skips: ['test.py$', '^test'] ``` would skip all asserts against a test file. Resolves PyCQA#346
This was referenced Aug 12, 2020
wilbertom
added a commit
to wilbertom/bandit
that referenced
this issue
Nov 24, 2020
Adding this configuration allows the user to skip the assert_used against some files. This is useful because asserts are very common in test files when using pytest. Specifying this configuration: ``` assert_used: skips: ['test.py$', '^test'] ``` would skip all asserts against a test file. Resolves PyCQA#346
wilbertom
added a commit
to wilbertom/bandit
that referenced
this issue
Nov 25, 2020
Adding this configuration allows the user to skip the assert_used against some files. This is useful because asserts are very common in test files when using pytest. Specifying this configuration: ``` assert_used: skips: ['*_test.py', 'test_*.py'] ``` would skip all asserts against a test file. Resolves PyCQA#346
lukehinds
added a commit
that referenced
this issue
Nov 30, 2020
* Add skip configuration to assert_used Adding this configuration allows the user to skip the assert_used against some files. This is useful because asserts are very common in test files when using pytest. Specifying this configuration: ``` assert_used: skips: ['*_test.py', 'test_*.py'] ``` would skip all asserts against a test file. Resolves #346 * Document assert test skipping Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
mikespallino
pushed a commit
to mikespallino/bandit
that referenced
this issue
Aug 25, 2021
* Add skip configuration to assert_used Adding this configuration allows the user to skip the assert_used against some files. This is useful because asserts are very common in test files when using pytest. Specifying this configuration: ``` assert_used: skips: ['*_test.py', 'test_*.py'] ``` would skip all asserts against a test file. Resolves PyCQA#346 * Document assert test skipping Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
Hi, the following may be helpful to configure |
mikespallino
pushed a commit
to mikespallino/bandit
that referenced
this issue
Jan 7, 2022
* Add skip configuration to assert_used Adding this configuration allows the user to skip the assert_used against some files. This is useful because asserts are very common in test files when using pytest. Specifying this configuration: ``` assert_used: skips: ['*_test.py', 'test_*.py'] ``` would skip all asserts against a test file. Resolves PyCQA#346 * Document assert test skipping Co-authored-by: Luke Hinds <7058938+lukehinds@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently you can exclude a directory and you can skip certain tests across all scanned files. It would be very handy to be able to exclude test_* pytest files from the B101 assert test with a simple one liner in the .bandit config file.
This is a feature request for something like:
In .bandit
Excluding all B101 is not a good solution, because I want to know about B101 in non-test modules.
Also, I'd like to be able to exclude on file filter like test_* rather than directory test/ because that filter works better across projects I have seen where test directory might not be named consistently, but all the pytests are generally named a special way e.g. test_*
This will allow a more general (across projects) config file to be set up.
The text was updated successfully, but these errors were encountered: