Commit ee5a2f1c authored by mar-ar's avatar mar-ar Committed by oroulet

added test

parent 45d60960
# coding: utf-8
import asyncio
import pytest
from asyncua import Client
from asyncua.ua.uaerrors import BadMaxConnectionsReached
from .conftest import port_num
pytestmark = pytest.mark.asyncio
async def test_max_connections_1(opc):
opc.server.iserver.isession.__class__.max_connections = 1
port = opc.server.endpoint.port
if port == port_num:
# if client we already have one connection
with pytest.raises(BadMaxConnectionsReached):
async with Client(f'opc.tcp://127.0.0.1:{port}'):
pass
else:
async with Client(f'opc.tcp://127.0.0.1:{port}'):
with pytest.raises(BadMaxConnectionsReached):
async with Client(f'opc.tcp://127.0.0.1:{port}'):
pass
opc.server.iserver.isession.__class__.max_connections = 1000
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment