Skip to content

Commit

Permalink
skip failing tests with pandas 2.1.0
Browse files Browse the repository at this point in the history
from 2a3db66
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).
  • Loading branch information
Anna Lee authored and olofk committed Nov 21, 2023
1 parent a29fdb9 commit 2862825
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions tests/test_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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))
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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"""

Expand All @@ -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"""

Expand All @@ -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"""

Expand All @@ -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"""

Expand All @@ -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"""

Expand All @@ -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"""

Expand Down Expand Up @@ -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)])
Expand Down Expand Up @@ -523,19 +540,23 @@ 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")
assert df.loc["Slice", "Util%"] == 33.69
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
Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 2862825

Please sign in to comment.