From 1d152b6e51c97f8527d1a675084f8bc15444d7f4 Mon Sep 17 00:00:00 2001 From: "Sakthipriyan Vairamani (thefourtheye)" Date: Thu, 18 Oct 2018 10:29:07 +0530 Subject: [PATCH] tools: prefer filter to remove empty strings Ref: https://github.com/nodejs/node/pull/23585#issuecomment-430585490 Python's `list.remove` will throw if the element is not found and also it removes only the first occurrence. This patch replaces the use of `list.remove` with a `filter` which solves both of the above mentioned problems. PR-URL: https://github.com/nodejs/node/pull/23727 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Rod Vagg Reviewed-By: Refael Ackermann Reviewed-By: Matheus Marchini Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- tools/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test.py b/tools/test.py index 0571f3394bcc38..3d0ba43beca8b5 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1381,8 +1381,8 @@ def ProcessOptions(options): options.arch = options.arch.split(',') options.mode = options.mode.split(',') options.run = options.run.split(',') - options.skip_tests = options.skip_tests.split(',') - options.skip_tests.remove("") + # Split at commas and filter out all the empty strings. + options.skip_tests = filter(bool, options.skip_tests.split(',')) if options.run == [""]: options.run = None elif len(options.run) != 2: