Skip to content

Commit 4a8bab3

Browse files
committed
Fix command line options machinery
... by refactoring essential pytest fixtures to the main package. They have been added to `testing` beforehand, which is just plain wrong, and broke the 0.4.0 release.
1 parent a54e9f8 commit 4a8bab3

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ pytest-mqtt changelog
55

66
in progress
77
===========
8+
- Fix command line options machinery by refactoring essential
9+
pytest fixtures to the main package. They have been added to ``testing``
10+
beforehand, which is just plain wrong, and broke the 0.4.0 release.
811

912
2024-03-31 0.4.0
1013
================

pytest_mqtt/mosquitto.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ def is_mosquitto_running(host: str, port: int) -> bool:
8080
return probe_tcp_connect(host, port)
8181

8282

83+
def pytest_addoption(parser) -> None:
84+
parser.addoption("--mqtt-host", action="store", type=str, default="localhost", help="MQTT host name")
85+
parser.addoption("--mqtt-port", action="store", type=int, default=1883, help="MQTT port number")
86+
87+
88+
@pytest.fixture(scope="session")
89+
def mqtt_settings(pytestconfig) -> MqttSettings:
90+
return MqttSettings(
91+
host=pytestconfig.getoption("--mqtt-host"),
92+
port=pytestconfig.getoption("--mqtt-port"),
93+
)
94+
95+
8396
@pytest.fixture(scope="session")
8497
def mosquitto(mqtt_settings: MqttSettings):
8598

testing/conftest.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)