Skip to content

Commit 8632b38

Browse files
committed
add tests for proxy gateways
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.
1 parent 35db0e7 commit 8632b38

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

testing/test_workermanage.py

+29
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,35 @@ def test_one():
368368
(rep,) = reprec.getreports("pytest_runtest_logreport")
369369
assert rep.passed
370370

371+
def test_proxy_gateway_setup_nodes(self, pytester: pytest.Pytester) -> None:
372+
nodemanager = NodeManager(
373+
pytester.parseconfig(
374+
"--px", "popen//id=my_proxy", "--tx", "popen//via=my_proxy"
375+
)
376+
)
377+
nodes = nodemanager.setup_nodes(None) # type: ignore[arg-type]
378+
379+
# Proxy gateways are considered as an execnet gateway
380+
assert len(nodemanager.group) == 2
381+
382+
# Proxy gateways do not run workers
383+
assert len(nodes) == 1
384+
385+
def test_proxy_gateway(self, pytester: pytest.Pytester) -> None:
386+
pytester.makepyfile(
387+
__init__="",
388+
test_x="""
389+
def test_one():
390+
pass
391+
""",
392+
)
393+
reprec = pytester.inline_run(
394+
"-d", "--px", "popen//id=my_proxy", "--tx", "popen//via=my_proxy"
395+
)
396+
rep = reprec.getreports("pytest_runtest_logreport")
397+
assert rep[1].passed
398+
399+
371400

372401
class MyWarning(UserWarning):
373402
pass

0 commit comments

Comments
 (0)