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']