File: test_backward_compatibility_112.py

package info (click to toggle)
liquidctl 1.16.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,452 kB
  • sloc: python: 15,304; sh: 712; xml: 84; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""Test backward compatibility with liquidctl 1.12.x."""

# uses the psf/black style

import pytest
from _testutils import MockHidapiDevice, Report, MockRuntimeStorage

from test_commander_pro import commanderProDevice


def test_initialize_commander_pro_fan_modes(commanderProDevice, caplog):
    """Fix #615 but preserve API compatibility."""

    responses = [
        "000009d4000000000000000000000000",  # firmware
        "00000500000000000000000000000000",  # bootloader
        "00010100010000000000000000000000",  # temp probes
        "00010102000000000000000000000000",  # fan set (throw away)
        "00010102000000000000000000000000",  # fan set (throw away)
        "00010102000000000000000000000000",  # fan set (throw away)
        "00010102000000000000000000000000",  # fan probes
    ]
    for d in responses:
        commanderProDevice.device.preload_read(Report(0, bytes.fromhex(d)))

    commanderProDevice.initialize(direct_access=True, fan_modes={"4": "dc"})

    sent = commanderProDevice.device.sent
    assert len(sent) == 5
    assert sent[3].data[0] == 0x28
    assert sent[3].data[2] == 3
    assert sent[3].data[3] == 1

    assert "deprecated parameter name `fan_modes`" in caplog.text