summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2016-08-02 11:00:27 +1200
committerDouglas Bagnall <dbagnall@samba.org>2016-08-31 07:09:26 +0200
commit85b4a3ea613b2f2b531551787f764c940bcf3f83 (patch)
tree6719bc24c9d5f8ea81d8db997de10c56fd97e9f8
parent809f4c718af00909bbce46ddde6a2688a88e73fc (diff)
downloadsamba-85b4a3ea613b2f2b531551787f764c940bcf3f83.tar.gz
filter-subunit: default to empty affixes, saving verbose checks
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
-rwxr-xr-xselftest/filter-subunit12
-rw-r--r--selftest/subunithelper.py9
2 files changed, 4 insertions, 17 deletions
diff --git a/selftest/filter-subunit b/selftest/filter-subunit
index fe157a0ec52..857b8420ead 100755
--- a/selftest/filter-subunit
+++ b/selftest/filter-subunit
@@ -36,9 +36,9 @@ parser.add_option("--strip-passed-output", action="store_true",
help="Whether to strip output from tests that passed")
parser.add_option("--fail-immediately", action="store_true",
help="Whether to stop on the first error", default=False)
-parser.add_option("--prefix", type="string",
+parser.add_option("--prefix", type="string", default='',
help="Add prefix to all test names")
-parser.add_option("--suffix", type="string",
+parser.add_option("--suffix", type="string", default='',
help="Add suffix to all test names")
parser.add_option("--fail-on-empty", default=False,
action="store_true", help="Fail if there was no subunit output")
@@ -47,14 +47,8 @@ parser.add_option("--list", default=False,
opts, args = parser.parse_args()
if opts.list:
- prefix = opts.prefix
- suffix = opts.suffix
- if not prefix:
- prefix = ""
- if not suffix:
- suffix = ""
for l in sys.stdin:
- sys.stdout.write("%s%s%s\n" % (prefix, l.rstrip(), suffix))
+ sys.stdout.write("%s%s%s\n" % (opts.prefix, l.rstrip(), opts.suffix))
sys.exit(0)
if opts.expected_failures:
diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py
index 441bafad926..a3bb30b69bc 100644
--- a/selftest/subunithelper.py
+++ b/selftest/subunithelper.py
@@ -287,14 +287,7 @@ class FilterOps(unittest.TestResult):
self._ops.startTest(test)
def _add_prefix(self, test):
- prefix = ""
- suffix = ""
- if self.prefix is not None:
- prefix = self.prefix
- if self.suffix is not None:
- suffix = self.suffix
-
- return subunit.RemotedTestCase(prefix + test.id() + suffix)
+ return subunit.RemotedTestCase(self.prefix + test.id() + self.suffix)
def addError(self, test, err=None):
test = self._add_prefix(test)