Fix port and allow silence float could be int

This commit is contained in:
Dominik Moritz Roth 2024-10-02 22:36:20 +02:00
parent 0d99378f7d
commit 9a690f42dc

View File

@ -2,10 +2,12 @@ import pytest
import warnings
from nucon import Nucon, NuconConfig, PumpStatus, PumpDryStatus, PumpOverloadStatus, BreakerStatus
WARN_FLOAT_COULD_BE_INT = False
@pytest.fixture(scope="module")
def nucon_setup():
Nucon.set_dummy_mode(False) # Assume the game is running
Nucon.set_base_url("http://localhost:8080/")
Nucon.set_base_url("http://localhost:8785/")
yield
Nucon.set_dummy_mode(True)
@ -14,7 +16,7 @@ def test_read_all_parameters(nucon_setup):
assert len(all_params) == len(Nucon)
for param, value in all_params.items():
assert isinstance(value, param.param_type), f"Parameter {param.name} has incorrect type. Expected {param.param_type}, got {type(value)}"
if param.param_type == float and value.is_integer():
if param.param_type == float and value.is_integer() and WARN_FLOAT_COULD_BE_INT:
warnings.warn(f"Parameter {param.name} is a float but has an integer value: {value}")
def test_write_writable_parameters(nucon_setup):