Skip to content
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

Cleanup comments after #510 #532

Merged
merged 2 commits into from
Aug 31, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion bandit/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ def main():
args.output_format,
args.msg_template)

# return an exit code of 1 if there are results, 0 otherwise
if (b_mgr.results_count(sev_filter=sev_level, conf_filter=conf_level) > 0
and not args.exit_zero):
sys.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/cli/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,13 @@ def test_main_exit_with_no_results(self):
@mock.patch('sys.argv', ['bandit', '-c', 'bandit.yaml', 'test', '-o',
'output', '--exit-zero'])
def test_main_exit_with_results_and_with_exit_zero_flag(self):
# Test that bandit exits when there are results
# Test that bandit exits with 0 on results and zero flag
temp_directory = self.useFixture(fixtures.TempDir()).path
os.chdir(temp_directory)
with open('bandit.yaml', 'wt') as fd:
fd.write(bandit_config_content)
with mock.patch('bandit.core.manager.BanditManager.results_count'
) as mock_mgr_results_ct:
mock_mgr_results_ct.return_value = 1
# assert a SystemExit with code 1

self.assertRaisesRegex(SystemExit, '0', bandit.main)