Skip to content

Commit

Permalink
Fix command line options machinery
Browse files Browse the repository at this point in the history
... 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.
  • Loading branch information
amotl committed May 8, 2024
1 parent a54e9f8 commit 4a8bab3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ pytest-mqtt changelog

in progress
===========
- 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.

2024-03-31 0.4.0
================
Expand Down
13 changes: 13 additions & 0 deletions pytest_mqtt/mosquitto.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ def is_mosquitto_running(host: str, port: int) -> bool:
return probe_tcp_connect(host, port)


def pytest_addoption(parser) -> None:
parser.addoption("--mqtt-host", action="store", type=str, default="localhost", help="MQTT host name")
parser.addoption("--mqtt-port", action="store", type=int, default=1883, help="MQTT port number")


@pytest.fixture(scope="session")
def mqtt_settings(pytestconfig) -> MqttSettings:
return MqttSettings(
host=pytestconfig.getoption("--mqtt-host"),
port=pytestconfig.getoption("--mqtt-port"),
)


@pytest.fixture(scope="session")
def mosquitto(mqtt_settings: MqttSettings):

Expand Down
16 changes: 0 additions & 16 deletions testing/conftest.py

This file was deleted.

0 comments on commit 4a8bab3

Please sign in to comment.