Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions srpcLib/stub_generator/python/server_python_stub_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from ...interface.srpc_stub_generator_interface import SrpcStubGeneratorInterface
from ...utils.srpc_stub import (
DEFAULT_CONNECTION_PORT,
LIB_NAME,
get_service_interface_class_name,
get_service_name,
Expand Down Expand Up @@ -89,14 +88,10 @@ def generate_stub(self, dest_path: str = None):
from {service_name}.{service_name}_interface import {service_interface_class_name}

class Srpc{service_name.capitalize()}ServerStub(SrpcServerStubInterface):
def __init__(self, tls_config: SrpcTLSConfig = None, host:str=None, num_threads = 8):
def __init__(self, tls_config: SrpcTLSConfig = None, host:str="127.0.0.1", port = 5000 ,num_threads = 8):

if host == None:
self.__host = srpcnetwork.get_lan_ip_or_localhost()
else:
self.__host = host

self.__CONNECTION_PORT = {DEFAULT_CONNECTION_PORT}
self.__host = host
self.__CONNECTION_PORT = port

self.__handler_threads_pool = ThreadPoolExecutor(max_workers=num_threads)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/project_with_tls/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from srpc_calc_server_stub import SrpcCalcServerStub, SrpcTLSConfig

tls_config = SrpcTLSConfig(certfile="./server.crt", keyfile="./server.key")
srpc_server = SrpcCalcServerStub(tls_config, "127.0.0.1")
srpc_server = SrpcCalcServerStub(tls_config=tls_config, host="127.0.0.1")
srpc_server.start()
4 changes: 2 additions & 2 deletions tests/integration/simple_project/client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from srpc_calc_client_stub import SrpcCalcClientStub

from srpcLib.utils.srpc_network import get_lan_ip_or_localhost
# from srpcLib.utils.srpc_network import get_lan_ip_or_localhost

SERVER_HOST = get_lan_ip_or_localhost()
SERVER_HOST = "127.0.0.1"
calcStub = SrpcCalcClientStub(SERVER_HOST, 5000)
a = 4
b = 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from srpc_calc_client_stub import SrpcCalcClientStub

from srpcLib.utils.srpc_network import get_lan_ip_or_localhost

SERVER_HOST = get_lan_ip_or_localhost()
SERVER_HOST = "127.0.0.1"
calcStub = SrpcCalcClientStub(SERVER_HOST, 5000)
a = 4
try:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_project_with_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def install_lib():
)


@pytest.fixture(scope="session", autouse=True)
@pytest.fixture(scope="function")
def generate_stubs():
"""
Run the stub generator as a CLI tool inside test_project.
Expand Down Expand Up @@ -95,7 +95,7 @@ def generate_stubs():
return TEST_PROJECT


@pytest.fixture(scope="session")
@pytest.fixture(scope="function")
def server_process(generate_stubs, request):
"""
Launch the server once for the entire test session.
Expand Down
8 changes: 3 additions & 5 deletions tests/integration/test_simple_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import pytest

from srpcLib.utils.srpc_network import get_lan_ip_or_localhost

# Paths
ROOT_DIR = Path(__file__).resolve().parents[2] # rpc-lib/
TEST_PROJECT = ROOT_DIR / "tests/integration/simple_project"
Expand All @@ -22,7 +20,7 @@
CLIENT_SCRIPT_DIVISION_BY_ZERO = "run_rpc_client_divizion_by_zero.py"

# Network
SERVER_HOST = get_lan_ip_or_localhost()
SERVER_HOST = "127.0.0.1"
SERVER_PORT = 5000


Expand All @@ -49,7 +47,7 @@ def install_lib():
)


@pytest.fixture(scope="session", autouse=True)
@pytest.fixture(scope="function")
def generate_stubs():
"""
Run the stub generator as a CLI tool inside test_project.
Expand Down Expand Up @@ -99,7 +97,7 @@ def generate_stubs():
return TEST_PROJECT


@pytest.fixture(scope="session")
@pytest.fixture(scope="function")
def server_process(generate_stubs, request):
"""
Launch the server once for the entire test session.
Expand Down