From 2862825465d8e5ef1c2c13d98710514ccf25f720 Mon Sep 17 00:00:00 2001 From: Anna Lee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> Date: Thu, 16 Nov 2023 04:44:30 +0000 Subject: [PATCH] skip failing tests with pandas 2.1.0 from https://github.com/olofk/edalize/commit/2a3db6658752f97c61048664b478ebfe65a909f8 There seems to be a bug with newer versions of pandas that prevents kwargs from being passed through the apply function (specifically passing errors='ignore' to to_numeric in edalize/vivado_reporting.py). --- tests/test_reporting.py | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/tests/test_reporting.py b/tests/test_reporting.py index 7c66aeb45..278b2d2dc 100644 --- a/tests/test_reporting.py +++ b/tests/test_reporting.py @@ -5,6 +5,8 @@ from .edalize_common import tests_dir +PANDAS_VERSION = tuple(map(int, pd.__version__.split(".")[:3])) + def check_types(s, allowed=[int, float]): """Check data structures use expected types @@ -39,7 +41,6 @@ def round_fmax(s, digits=3): def test_missing_dir(): - from edalize.reporting import Reporting data_dir = Path(tests_dir + "/test_reporting/data/doesntexist") @@ -50,7 +51,6 @@ def test_missing_dir(): def test_no_reports(tmp_path): - from edalize.reporting import Reporting rpt = Reporting.report(str(tmp_path)) @@ -59,7 +59,6 @@ def test_no_reports(tmp_path): def test_missing_reports(tmp_path): - from edalize.reporting import Reporting (tmp_path / "top1_resource_report.txt").touch() @@ -70,7 +69,6 @@ def test_missing_reports(tmp_path): def test_extra_reports(tmp_path): - from edalize.reporting import Reporting (tmp_path / "top1_resource_report.txt").touch() @@ -83,7 +81,6 @@ def test_extra_reports(tmp_path): def test_period_to_freq(): - from edalize.reporting import Reporting assert Reporting.period_to_freq(10.0) == 100 @@ -348,6 +345,9 @@ def picorv32_artix7_data(): return rpt +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_picorv32_artix7_summary(picorv32_artix7_data): """Check all summary fields""" @@ -367,6 +367,9 @@ def test_picorv32_artix7_summary(picorv32_artix7_data): assert round_fmax(summary, digits=4) == expected +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_picorv32_artix7_resources(picorv32_artix7_data): """Check selected resource report fields""" @@ -383,6 +386,9 @@ def test_picorv32_artix7_resources(picorv32_artix7_data): assert df.at["DSPs", "Available"] == 740 +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_picorv32_artix7_timing(picorv32_artix7_data): """Check selected timing report fields""" @@ -409,6 +415,9 @@ def picorv32_kusp_data(): return rpt +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_picorv32_kusp_summary(picorv32_kusp_data): """Check all summary fields""" @@ -428,6 +437,9 @@ def test_picorv32_kusp_summary(picorv32_kusp_data): assert round_fmax(summary, 4) == expected +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_picorv32_kusp_resources(picorv32_kusp_data): """Check selected resource report fields""" @@ -447,6 +459,9 @@ def test_picorv32_kusp_resources(picorv32_kusp_data): assert list(tables["Instantiated Netlists"].columns) == ["Ref Name", "Used"] +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_picorv32_kusp_timing(picorv32_kusp_data): """Check selected timing report fields""" @@ -481,8 +496,10 @@ def linux_on_litex_vexriscv_arty_a7_data(): return result +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_linux_on_litex_vexriscv_arty_a7_summary(linux_on_litex_vexriscv_arty_a7_data): - summary = linux_on_litex_vexriscv_arty_a7_data["summary"] check_types(summary, allowed=[int, float, type(None)]) @@ -523,10 +540,12 @@ def test_linux_on_litex_vexriscv_arty_a7_summary(linux_on_litex_vexriscv_arty_a7 assert round_fmax(summary, 4) == expected +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_linux_on_litex_vexriscv_arty_a7_resources( linux_on_litex_vexriscv_arty_a7_data, ): - rpt = linux_on_litex_vexriscv_arty_a7_data["resources"] df = rpt["Slice Logic Distribution"].set_index("Site Type") @@ -534,8 +553,10 @@ def test_linux_on_litex_vexriscv_arty_a7_resources( assert df.loc["LUT as Distributed RAM", "Used"] == 1932 +@pytest.mark.skipif( + PANDAS_VERSION >= (2, 1, 0), reason="apply(...,error='ignore') ignored" +) def test_linux_on_litex_vexriscv_arty_a7_timing(linux_on_litex_vexriscv_arty_a7_data): - rpt = linux_on_litex_vexriscv_arty_a7_data["timing"] assert rpt["Design Timing Summary"]["TNS(ns)"][0] == 0.0 @@ -563,7 +584,6 @@ def linux_on_litex_vexriscv_de10nano_data(): def test_linux_on_litex_vexriscv_de10nano_summary( linux_on_litex_vexriscv_de10nano_data, ): - summary = linux_on_litex_vexriscv_de10nano_data["summary"] check_types(summary) @@ -583,7 +603,6 @@ def test_linux_on_litex_vexriscv_de10nano_summary( def test_linux_on_litex_vexriscv_de10nano_resources( linux_on_litex_vexriscv_de10nano_data, ): - rpt = linux_on_litex_vexriscv_de10nano_data["resources"] df = rpt["Fitter DSP Block Usage Summary"].set_index("Statistic") @@ -599,7 +618,6 @@ def test_linux_on_litex_vexriscv_de10nano_resources( def test_linux_on_litex_vexriscv_de10nano_timing(linux_on_litex_vexriscv_de10nano_data): - rpt = linux_on_litex_vexriscv_de10nano_data["timing"] df = rpt["Clocks"].set_index("Clock Name")