Skip to content

Commit 2413572

Browse files
committed
Allow running tests in parallel (don't reuse addresses)
1 parent 5e38e7f commit 2413572

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+128
-128
lines changed

tests/lib/clients/01-asyncio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import paho.mqtt.client as mqtt
55

6+
from tests.paho_test import get_test_server_port
7+
68
client_id = 'asyncio-test'
79

810

@@ -78,7 +80,7 @@ def on_disconnect(client, userdata, rc):
7880

7981
_aioh = AsyncioHelper(loop, client)
8082

81-
client.connect('localhost', 1888, 60)
83+
client.connect('localhost', get_test_server_port(), 60)
8284
client.socket().setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 2048)
8385

8486
await disconnected

tests/lib/clients/01-decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import loop_until_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
44

55
mqttc = mqtt.Client("decorators-test", clean_session=True)
66
payload = b""
@@ -38,5 +38,5 @@ def on_disconnect(mqttc, obj, rc):
3838
pass # TODO: should probably test that this gets called
3939

4040

41-
mqttc.connect("localhost", 1888)
41+
mqttc.connect("localhost", get_test_server_port())
4242
loop_until_keyboard_interrupt(mqttc)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import loop_until_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
44

55

66
def on_connect(mqttc, obj, flags, rc):
@@ -10,5 +10,5 @@ def on_connect(mqttc, obj, flags, rc):
1010
mqttc = mqtt.Client("01-keepalive-pingreq")
1111
mqttc.on_connect = on_connect
1212

13-
mqttc.connect("localhost", 1888, keepalive=4)
13+
mqttc.connect("localhost", get_test_server_port(), keepalive=4)
1414
loop_until_keyboard_interrupt(mqttc)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import loop_until_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
44

55
mqttc = mqtt.Client("01-no-clean-session", clean_session=False)
66

7-
mqttc.connect("localhost", 1888)
7+
mqttc.connect("localhost", get_test_server_port())
88
loop_until_keyboard_interrupt(mqttc)

tests/lib/clients/01-reconnect-on-failure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import wait_for_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, wait_for_keyboard_interrupt
44

55

66
def on_connect(mqttc, obj, flags, rc):
@@ -11,6 +11,6 @@ def on_connect(mqttc, obj, flags, rc):
1111
mqttc.on_connect = on_connect
1212

1313
with wait_for_keyboard_interrupt():
14-
mqttc.connect("localhost", 1888)
14+
mqttc.connect("localhost", get_test_server_port())
1515
mqttc.loop_forever()
1616
exit(42) # this is expected by the test case
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import loop_until_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
44

55
mqttc = mqtt.Client("01-unpwd-set")
66

77
mqttc.username_pw_set("uname", "")
8-
mqttc.connect("localhost", 1888)
8+
mqttc.connect("localhost", get_test_server_port())
99
loop_until_keyboard_interrupt(mqttc)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import loop_until_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
44

55
mqttc = mqtt.Client("01-unpwd-set")
66

77
mqttc.username_pw_set("", "")
8-
mqttc.connect("localhost", 1888)
8+
mqttc.connect("localhost", get_test_server_port())
99
loop_until_keyboard_interrupt(mqttc)

tests/lib/clients/01-unpwd-set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import loop_until_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
44

55
mqttc = mqtt.Client("01-unpwd-set")
66

77
mqttc.username_pw_set("uname", ";'[08gn=#")
8-
mqttc.connect("localhost", 1888)
8+
mqttc.connect("localhost", get_test_server_port())
99
loop_until_keyboard_interrupt(mqttc)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
import paho.mqtt.client as mqtt
33

4-
from tests.paho_test import loop_until_keyboard_interrupt
4+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
55

66
mqttc = mqtt.Client("01-unpwd-unicode-set")
77

88
username = "\u00fas\u00e9rn\u00e1m\u00e9-h\u00e9ll\u00f3"
99
password = "h\u00e9ll\u00f3"
1010
mqttc.username_pw_set(username, password)
11-
mqttc.connect("localhost", 1888)
11+
mqttc.connect("localhost", get_test_server_port())
1212
loop_until_keyboard_interrupt(mqttc)

tests/lib/clients/01-will-set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import paho.mqtt.client as mqtt
22

3-
from tests.paho_test import loop_until_keyboard_interrupt
3+
from tests.paho_test import get_test_server_port, loop_until_keyboard_interrupt
44

55
mqttc = mqtt.Client("01-will-set")
66

77
mqttc.will_set("topic/on/unexpected/disconnect", "will message", 1, True)
8-
mqttc.connect("localhost", 1888)
8+
mqttc.connect("localhost", get_test_server_port())
99
loop_until_keyboard_interrupt(mqttc)

0 commit comments

Comments
 (0)