def before_all(context): # for behave-rest context.base_url = "" context.headers = {} context.json_responses = json_responses context.verify_ssl = False # Be sure to use a fresh install of the vendored packages for this chaincode # shutil.rmtree("../fabric/examples/chaincode/go/enccc_example/vendor", ignore_errors=True) # Performing `npm install` before test suit not before test cases. # shutil.rmtree("./node_modules", ignore_errors=True) # shutil.rmtree("./package-lock.json", ignore_errors=True) # shutil.copyfile("package.json", "../../../package.json") npminstall = subprocess.check_output(["npm install --silent"], env=os.environ, cwd=".", shell=True) print("npm install: {}".format(npminstall)) # shutil.copytree("../../../node_modules", "./node_modules") context.interface = CLIInterface() context.remote = False if context.config.userdata.get("network", None) is not None: context.network = context.config.userdata["network"] context.remote = True context.interface = ToolInterface(context) # Stop node app of balance-transfer example subprocess.call(["kill -15 $(lsof -i:4000 -t) 2>/dev/null"], shell=True) mem = psutil.virtual_memory() print("Starting Memory Info:\n\tFree: {}\n\tUsed: {}\n\tPercentage: {}\n".format(mem.free, mem.used, mem.percent))
def before_all(context): context.interface = CLIInterface() context.remote = False if context.config.userdata.get("network", None) is not None: context.network = context.config.userdata["network"] context.remote = True context.interface = ToolInterface(context)
def before_all(context): # Be sure to use a fresh install of the vendored packages for this chaincode shutil.rmtree("../fabric/examples/chaincode/go/enccc_example/vendor", ignore_errors=True) # Performing `npm install` before test suit not before test cases. shutil.rmtree("./node_modules", ignore_errors=True) shutil.rmtree("./package-lock.json", ignore_errors=True) shutil.copyfile("package.json", "../../../package.json") npminstall = subprocess.check_output(["npm install --silent"], env=os.environ, cwd="../../..", shell=True) print("npm install: {}".format(npminstall)) shutil.copytree("../../../node_modules", "./node_modules") context.interface = CLIInterface() context.remote = False if context.config.userdata.get("network", None) is not None: context.network = context.config.userdata["network"] context.remote = True context.interface = ToolInterface(context) mem = psutil.virtual_memory() print("Starting Memory Info:\n\tFree: {}\n\tUsed: {}\n\tPercentage: {}\n". format(mem.free, mem.used, mem.percent))
def before_all(context): context.interface = CLIInterface() context.remote = False if context.config.userdata.get("network", None) is not None: context.network = context.config.userdata["network"] context.remote = True context.interface = ToolInterface(context) mem = psutil.virtual_memory() print("Starting Memory Info:\n\tFree: {}\n\tUsed: {}\n\tPercentage: {}\n".format(mem.free, mem.used, mem.percent))
def before_scenario(context, scenario): # Remove all existing containers if any output = str(subprocess.check_output(["docker ps -aq"], shell=True)) container_list = output.strip().split('\n') for container in container_list: if container != '': subprocess.call(['docker rm -f {}'.format(container)], shell=True) context.interface = CLIInterface() if context.remote == True: context.interface = ToolInterface(context) context.newlifecycle = False