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.
This commit is contained in:
@@ -368,6 +368,35 @@ class TestNodeManager:
|
|||||||
(rep,) = reprec.getreports("pytest_runtest_logreport")
|
(rep,) = reprec.getreports("pytest_runtest_logreport")
|
||||||
assert rep.passed
|
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):
|
class MyWarning(UserWarning):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user