From 1b1a3b64f3a32650357d379808b164531d27da85 Mon Sep 17 00:00:00 2001 From: Anton Beloglazov Date: Tue, 24 Mar 2015 16:16:44 +1100 Subject: [PATCH] Updated common.parse_compute_hosts to allow host names that include - and _ --- neat/common.py | 2 +- tests/test_common.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/neat/common.py b/neat/common.py index c37d654..7915276 100644 --- a/neat/common.py +++ b/neat/common.py @@ -249,7 +249,7 @@ def parse_compute_hosts(compute_hosts): :return: A list of host names. :rtype: list(str) """ - return filter(None, re.split('\W+', compute_hosts)) + return filter(None, re.split('[^a-zA-Z0-9\-_]+', compute_hosts)) @contract diff --git a/tests/test_common.py b/tests/test_common.py index e1d46ae..5a59992 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -156,6 +156,8 @@ class Common(TestCase): assert common.parse_compute_hosts('') == [] assert common.parse_compute_hosts('test1, test2') == \ ['test1', 'test2'] + assert common.parse_compute_hosts('test-1, test_2') == \ + ['test-1', 'test_2'] assert common.parse_compute_hosts('t1,, t2 , t3') == \ ['t1', 't2', 't3']