Don't run unit or integration tests unnecessarily

If --from-filenames (and optionally --filename-map) yield no matches,
this will keep from running the entire unit/integration suite.
This commit is contained in:
Erik Johnson 2018-04-24 22:29:32 -05:00
parent 569276bedf
commit b851a41ef8
No known key found for this signature in database
GPG Key ID: 5E5583C437808F3F

View File

@ -718,13 +718,16 @@ class SaltTestsuiteParser(SaltCoverageTestingParser):
continue
named_tests.append(test)
if (self.options.unit or self.options.kitchen or named_unit_test) and not named_tests and not \
self._check_enabled_suites(include_cloud_provider=True):
if (self.options.unit or self.options.kitchen or named_unit_test) \
and not named_tests \
and (self.options.from_filenames or
not self._check_enabled_suites(include_cloud_provider=True)):
# We're either not running any integration test suites, or we're
# only running unit tests by passing --unit or by passing only
# `unit.<whatever>` to --name. We don't need the tests daemon
# running
return [True]
if not salt.utils.platform.is_windows():
self.set_filehandle_limits('integration')
@ -779,9 +782,11 @@ class SaltTestsuiteParser(SaltCoverageTestingParser):
continue
named_unit_test.append(test)
if not self.options.unit and not named_unit_test:
if not named_unit_test \
and (self.options.from_filenames or not self.options.unit):
# We are not explicitly running the unit tests and none of the
# names passed to --name is a unit test.
# names passed to --name (or derived via --from-filenames) is a
# unit test.
return [True]
status = []