コード例 #1
0
ファイル: test_hdd.py プロジェクト: KostyaEsmukov/afancontrol
def test_hddtemp_exec_failed():
    t = HDDTemp(
        disk_path="/dev/sd?",
        min=TempCelsius(38.0),
        max=TempCelsius(45.0),
        panic=TempCelsius(50.0),
        threshold=None,
        hddtemp_bin="false",
    )
    with pytest.raises(subprocess.CalledProcessError):
        t._call_hddtemp()
コード例 #2
0
ファイル: test_hdd.py プロジェクト: KostyaEsmukov/afancontrol
def test_hddtemp_exec_successful(temp_path):
    (temp_path / "sda").write_text("")
    (temp_path / "sdz").write_text("")
    t = HDDTemp(
        disk_path=str(temp_path / "sd") + "?",
        min=TempCelsius(38.0),
        max=TempCelsius(45.0),
        panic=TempCelsius(50.0),
        threshold=None,
        hddtemp_bin="printf '@%s'",
    )
    expected_out = "@-n@-u@C@--@{0}/sda@{0}/sdz".format(temp_path)
    assert expected_out == t._call_hddtemp()