def test_parse_cpu_info(filename, expected_cpus, expected_cpu):
    with patch('builtins.open',
               new=create_open_mock(
                   {"/proc/cpuinfo": open(relative_module_path(__file__, filename)).read()})
               ):
        got_data = _parse_cpuinfo()
        assert len(got_data) == expected_cpus
        assert _is_dict_match(got_data[0], expected_cpu), 'some keys do not match!'
Ejemplo n.º 2
0
def test_is_dict_match(got_dict, expected_subdict, expected_match):
    assert _is_dict_match(got_dict, expected_subdict) == expected_match