Skip to content

Commit

Permalink
Cleanup comments after #510
Browse files Browse the repository at this point in the history
  • Loading branch information
florczakraf authored and ericwb committed Aug 31, 2019
1 parent b05a376 commit 922f401
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
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)

0 comments on commit 922f401

Please sign in to comment.