From 3af1d0c8270e50d628206f56f5f4734439fd58b6 Mon Sep 17 00:00:00 2001 From: Francesco Basile <59255877+parmigggiana@users.noreply.github.com> Date: Fri, 11 Oct 2024 19:33:14 +0200 Subject: [PATCH] fix some tests --- src/peracotta/parsers/read_decode_dimms.py | 2 +- tests/integration/test_integration.py | 2 +- tests/parsers/test_alecase.py | 6 +++--- tests/parsers/test_asdpc.py | 2 +- tests/parsers/test_castes-pc.py | 3 ++- tests/parsers/test_dimms.py | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/peracotta/parsers/read_decode_dimms.py b/src/peracotta/parsers/read_decode_dimms.py index 62d0c7c..3cfd753 100755 --- a/src/peracotta/parsers/read_decode_dimms.py +++ b/src/peracotta/parsers/read_decode_dimms.py @@ -38,7 +38,7 @@ def parse_decode_dimms(dimms: str, interactive: bool = False) -> List[dict]: for line in dimm.splitlines(): if line.startswith("Fundamental Memory type"): dimms[i]["ram-type"] = line.split(" ")[-2].upper() - if dimms[i]["ram-type"] == "unknown": + if dimms[i]["ram-type"] == "UNKNOWN": del dimms[i]["ram-type"] if line.startswith("Maximum module speed"): diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 25c6071..47c2f26 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -40,7 +40,7 @@ def import_executable(name): # def test_get_gpu(args): # checking that gpu_location is correctly read # # checking mutual exclusion -# assert [args.cpu, args.gpu, args.motherboard].count(True) <= 1 +# assert all([args.cpu, args.gpu, args.motherboard].count(True) <= 1 @pytest.fixture(params=test_folders) diff --git a/tests/parsers/test_alecase.py b/tests/parsers/test_alecase.py index 7a3bf9a..105f48b 100644 --- a/tests/parsers/test_alecase.py +++ b/tests/parsers/test_alecase.py @@ -44,7 +44,7 @@ def test_lscpu(): def test_ram(): expect = [ { - "brand": "Micron Technology", + "brand": "Crucial Technology", "capacity-byte": 8589934592, "frequency-hertz": 1600000000, "model": "CT102464BA160B.C16", @@ -56,7 +56,7 @@ def test_ram(): "working": "yes", }, { - "brand": "Micron Technology", + "brand": "Crucial Technology", "capacity-byte": 8589934592, "frequency-hertz": 1600000000, "model": "CT102464BA160B.C16", @@ -70,7 +70,7 @@ def test_ram(): ] output = read_decode_dimms.parse_decode_dimms(read_file(filedir, "dimms.txt")) assert len(output) == 2, "2 RAM modules are found" - assert [d in expect for d in output], "The RAM modules are the expected ones" + assert all([d in expect for d in output]), "The RAM modules are the expected ones" def test_baseboard(): diff --git a/tests/parsers/test_asdpc.py b/tests/parsers/test_asdpc.py index 8deae36..5fa1817 100644 --- a/tests/parsers/test_asdpc.py +++ b/tests/parsers/test_asdpc.py @@ -68,7 +68,7 @@ def test_ram(): output = read_decode_dimms.parse_decode_dimms(read_file(filedir, "dimms.txt")) assert len(output) == 2, "2 RAM modules are found" - assert [d in expect for d in output], "The RAM modules are the expected ones" + assert all([d in expect for d in output]), "The RAM modules are the expected ones" def test_baseboard(): diff --git a/tests/parsers/test_castes-pc.py b/tests/parsers/test_castes-pc.py index 8811bd4..370bee6 100644 --- a/tests/parsers/test_castes-pc.py +++ b/tests/parsers/test_castes-pc.py @@ -59,7 +59,8 @@ def test_ram(): output = read_decode_dimms.parse_decode_dimms(read_file(filedir, "dimms.txt")) assert len(output) == 2, "2 RAM modules are found" - assert [d in expect for d in output], "The RAM modules are the expected ones" + print(output) + assert all([d in expect for d in output]), "The RAM modules are the expected ones" def test_baseboard(): diff --git a/tests/parsers/test_dimms.py b/tests/parsers/test_dimms.py index f7a04ef..249294f 100644 --- a/tests/parsers/test_dimms.py +++ b/tests/parsers/test_dimms.py @@ -36,7 +36,7 @@ def test_ecc_ram1(): output = read_decode_dimms.parse_decode_dimms(read_file(filedir, "ECC/R451-R450.txt")) assert len(output) == 2, "There are two RAM modules" - assert [d in expect for d in output], "The RAM modules are the expected ones" + assert all([d in expect for d in output]), "The RAM modules are the expected ones" def test_ecc_ram1_not_an_hex():