Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
test(cli): add unittest for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
jemmyshin committed Sep 12, 2019
1 parent 9c1a606 commit 5d94cc9
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_client_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import unittest
import os
from gnes.cli.parser import set_frontend_parser, set_router_parser, set_client_cli_parser
from gnes.service.base import SocketType
from gnes.service.frontend import FrontendService
from gnes.service.router import RouterService
from gnes.client.cli import CLIClient


class TestCLI(unittest.TestCase):
def setUp(self):
self.dirname = os.path.dirname(__file__)
os.unsetenv('http_proxy')
os.unsetenv('https_proxy')

def test_cli(self):
cli_args = set_client_cli_parser().parse_args([
'--mode', 'train',
'--grpc_host', '127.0.0.1',
'--txt_file', 'sonnets.txt'
])

args = set_frontend_parser().parse_args([
])

p_args = set_router_parser().parse_args([
'--port_in', str(args.port_out),
'--port_out', str(args.port_in),
'--socket_in', str(SocketType.PULL_CONNECT),
'--socket_out', str(SocketType.PUSH_CONNECT),
'--host_in', '127.0.0.1',
'--host_out', '127.0.0.1',
'--yaml_path', 'BaseRouter'
])

with RouterService(p_args), FrontendService(args) as s:
CLIClient(cli_args)


0 comments on commit 5d94cc9

Please sign in to comment.