Skip to content

Commit

Permalink
add tests for proxy gateways
Browse files Browse the repository at this point in the history
The test `test_proxy_gateway_setup_nodes` makes sure that 2 execnet
gateways are created, but only one node is allocated.

The test `test_proxy_gateway` tries to run a test on a proxy.
  • Loading branch information
Alon-L committed Jan 12, 2025
1 parent 35db0e7 commit 8632b38
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions testing/test_workermanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,35 @@ def test_one():
(rep,) = reprec.getreports("pytest_runtest_logreport")
assert rep.passed

def test_proxy_gateway_setup_nodes(self, pytester: pytest.Pytester) -> None:
nodemanager = NodeManager(
pytester.parseconfig(
"--px", "popen//id=my_proxy", "--tx", "popen//via=my_proxy"
)
)
nodes = nodemanager.setup_nodes(None) # type: ignore[arg-type]

# Proxy gateways are considered as an execnet gateway
assert len(nodemanager.group) == 2

# Proxy gateways do not run workers
assert len(nodes) == 1

def test_proxy_gateway(self, pytester: pytest.Pytester) -> None:
pytester.makepyfile(
__init__="",
test_x="""
def test_one():
pass
""",
)
reprec = pytester.inline_run(
"-d", "--px", "popen//id=my_proxy", "--tx", "popen//via=my_proxy"
)
rep = reprec.getreports("pytest_runtest_logreport")
assert rep[1].passed



class MyWarning(UserWarning):
pass
Expand Down

0 comments on commit 8632b38

Please sign in to comment.