Commit c1587bbe authored by Julien Muchembled's avatar Julien Muchembled

tests: do not require PATH to be set

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2689 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 9fa43955
...@@ -30,6 +30,7 @@ import tempfile ...@@ -30,6 +30,7 @@ import tempfile
import traceback import traceback
import threading import threading
import neo.scripts
from neo.neoctl.neoctl import NeoCTL, NotReadyException from neo.neoctl.neoctl import NeoCTL, NotReadyException
from neo.lib.protocol import ClusterStates, NodeTypes, CellStates, NodeStates from neo.lib.protocol import ClusterStates, NodeTypes, CellStates, NodeStates
from neo.lib.util import dump, SOCKET_CONNECTORS_DICT from neo.lib.util import dump, SOCKET_CONNECTORS_DICT
...@@ -104,17 +105,11 @@ class NEOProcess(object): ...@@ -104,17 +105,11 @@ class NEOProcess(object):
pid = 0 pid = 0
def __init__(self, command, uuid, arg_dict): def __init__(self, command, uuid, arg_dict):
path = os.getenv('PATH') try:
split_path = path.split(":") __import__('neo.scripts.' + command)
except ImportError:
for elt_path in split_path:
command_tmp = "%s/%s" % (elt_path, command)
if os.path.exists(command_tmp):
self.command = command_tmp
break
else:
raise NotFound, '%s not found' % (command) raise NotFound, '%s not found' % (command)
self.command = command
self.arg_dict = arg_dict self.arg_dict = arg_dict
self.with_uuid = True self.with_uuid = True
self.setUUID(uuid) self.setUUID(uuid)
...@@ -137,7 +132,7 @@ class NEOProcess(object): ...@@ -137,7 +132,7 @@ class NEOProcess(object):
# Child # Child
try: try:
sys.argv = [command] + args sys.argv = [command] + args
execfile(command, {"__name__": "__main__"}) getattr(neo.scripts, command).main()
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
self._exit() self._exit()
except: except:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment