Commit fea1061c authored by zhifan huang's avatar zhifan huang Committed by Xiaowu Zhang

chore(test): use a single DEMO_DIR definition.

Remove duplicate definitions of DEMO_DIR, and define it in the tests
module
parent 64461269
from pathlib2 import Path
DEMO_PATH = Path(__file__).resolve().parent.parent.parent / "demo"
...@@ -11,8 +11,8 @@ import zlib ...@@ -11,8 +11,8 @@ import zlib
from re6st import registry, x509 from re6st import registry, x509
from re6st.tests.test_network import re6st_wrap from re6st.tests.test_network import re6st_wrap
from re6st.tests import tools from re6st.tests import tools
from re6st.tests import DEMO_PATH
DEMO_PATH = Path(__file__).parent.parent.parent.parent / "demo"
DH_FILE = DEMO_PATH / "dh2048.pem" DH_FILE = DEMO_PATH / "dh2048.pem"
class dummyNode(): class dummyNode():
......
...@@ -6,7 +6,8 @@ import logging ...@@ -6,7 +6,8 @@ import logging
from subprocess import PIPE from subprocess import PIPE
from pathlib2 import Path from pathlib2 import Path
DEMO_PATH = Path(__file__).resolve().parent.parent.parent.parent / "demo" from re6st.tests import DEMO_PATH
fix_file = DEMO_PATH / "fixnemu.py" fix_file = DEMO_PATH / "fixnemu.py"
# execfile(str(fix_file)) Removed in python3 # execfile(str(fix_file)) Removed in python3
exec(open(str(fix_file)).read()) exec(open(str(fix_file)).read())
......
...@@ -11,13 +11,14 @@ import re ...@@ -11,13 +11,14 @@ import re
import tempfile import tempfile
import logging import logging
import errno import errno
from subprocess import PIPE, call from subprocess import PIPE
from pathlib2 import Path from pathlib2 import Path
import re6st.tests.tools as tools from re6st.tests import tools
from re6st.tests import DEMO_PATH
WORK_DIR = Path(__file__).parent / "temp_net_test" WORK_DIR = Path(__file__).parent / "temp_net_test"
DH_FILE = WORK_DIR / "dh2048.pem" DH_FILE = DEMO_PATH / "dh2048.pem"
RE6STNET = "re6stnet" RE6STNET = "re6stnet"
RE6STNET = "python -m re6st.cli.node" RE6STNET = "python -m re6st.cli.node"
...@@ -244,6 +245,9 @@ class Re6stNode(object): ...@@ -244,6 +245,9 @@ class Re6stNode(object):
cmd += args cmd += args
logging.debug("run node %s at ns: %s with cmd: %s", logging.debug("run node %s at ns: %s with cmd: %s",
self.name, self.node.pid, " ".join(cmd)) self.name, self.node.pid, " ".join(cmd))
# if len(args) > 4 :
# self.proc = self.node.Popen(cmd)
# else:
self.proc = self.node.Popen(cmd, stdout=PIPE, stderr=PIPE) self.proc = self.node.Popen(cmd, stdout=PIPE, stderr=PIPE)
def clean(self): def clean(self):
......
...@@ -12,7 +12,6 @@ import re6st_wrap ...@@ -12,7 +12,6 @@ import re6st_wrap
import network_build import network_build
PING_PATH = str(Path(__file__).parent.resolve() / "ping.py") PING_PATH = str(Path(__file__).parent.resolve() / "ping.py")
BABEL_HMAC = 'babel_hmac0', 'babel_hmac1', 'babel_hmac2'
def deploy_re6st(nm, recreate=False): def deploy_re6st(nm, recreate=False):
net = nm.registries net = nm.registries
......
...@@ -17,12 +17,11 @@ from pathlib2 import Path ...@@ -17,12 +17,11 @@ from pathlib2 import Path
from re6st import registry from re6st import registry
from re6st.tests.tools import * from re6st.tests.tools import *
from re6st.tests import DEMO_PATH
# TODO test for request_dump, requestToken, getNetworkConfig, getBoostrapPeer # TODO test for request_dump, requestToken, getNetworkConfig, getBoostrapPeer
# getIPV4Information, versions # getIPV4Information, versions
DEMO_PATH = Path(__file__).parent.parent.parent.parent / "demo"
def load_config(filename="registry.json"): def load_config(filename="registry.json"):
with open(filename) as f: with open(filename) as f:
config = json.load(f) config = json.load(f)
......
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