cjkrolak / ThermostatSupervisor

supervisor to detect and correct thermostat deviations
MIT License
0 stars 0 forks source link

sht31: flask server test fails in Windows environment #754

Closed cjkrolak closed 10 months ago

cjkrolak commented 10 months ago

new call to iwconfig won't work in a windows environment, causes a unit test failure. ST plan is to disable test in Windows, LT plan should be to add a windows-compatible wifi signal strength function.

======================================================================
ERROR: test_sht31_flask_server (__main__.IntegrationTest.test_sht31_flask_server)
Confirm Flask server returns valid data.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\sht31.py", line 297, in get_metadata
    return response.json()[parameter]
           ~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'Temp(F) mean'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\sht31.py", line 297, in get_metadata
    return response.json()[parameter]
           ~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'Temp(F) mean'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\cjkro\AppData\Local\Programs\Python\Python312\Lib\unittest\mock.py", line 1387, in patched
    return func(*newargs, **newkeywargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\tests\test_sht31_flask_server.py", line 91, in test_sht31_flask_server
    self.validate_flask_server()
  File "C:\github\ThermostatSupervisor\tests\test_sht31_flask_server.py", line 121, in validate_flask_server
    f"{util.temp_value_with_units(Zone.get_display_temp())}")
                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\sht31.py", line 346, in get_display_temp
    return float(self.get_metadata(self.tempfield))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\sht31.py", line 330, in get_metadata
    self.get_metadata(parameter, retry=False)
  File "C:\github\ThermostatSupervisor\thermostatsupervisor\sht31.py", line 332, in get_metadata
    raise KeyError(
KeyError: "FATAL ERROR: SHT31 server response did not contain key 'Temp(F) mean', raw response={'message': 'Internal Server Error'}"

----------------------------------------------------------------------