Don't run with no tests
Running with no tests is meaningless. It's also likely an issue with installation and should be communicated clearly. Closes-bug: 1472922 Change-Id: I951ee7862dd90c03ea19895bb0201d4622ee6f91
This commit is contained in:
parent
055598028a
commit
83baf7ba82
@ -142,6 +142,12 @@ def main():
|
||||
)
|
||||
sys.exit(2)
|
||||
|
||||
# no point running if there are no tests available
|
||||
if not b_mgr.has_tests:
|
||||
logger.error('Could not find any tests to apply, please check '
|
||||
'the configuration.')
|
||||
sys.exit(2)
|
||||
|
||||
# initiate file discovery step within Bandit Manager
|
||||
b_mgr.discover_files(args.targets, args.recursive)
|
||||
|
||||
|
@ -81,6 +81,10 @@ class BanditManager():
|
||||
self.progress = self.b_conf.get_setting('progress')
|
||||
self.scores = []
|
||||
|
||||
@property
|
||||
def has_tests(self):
|
||||
return self.b_ts.has_tests
|
||||
|
||||
@property
|
||||
def get_logger(self):
|
||||
return self.logger
|
||||
|
@ -213,3 +213,7 @@ class BanditTestSet():
|
||||
self.logger.debug('get_tests returning scoped_tests : %s',
|
||||
scoped_tests)
|
||||
return scoped_tests
|
||||
|
||||
@property
|
||||
def has_tests(self):
|
||||
return bool(self.tests)
|
||||
|
Loading…
x
Reference in New Issue
Block a user