From 0047dca213f68f00c552ff7feed65a677cf89044 Mon Sep 17 00:00:00 2001 From: Dario Quintero Date: Wed, 9 Aug 2023 11:27:36 +0100 Subject: [PATCH] FEAT: Automated full testing including examples --- docs/examples/03_sax_basics.py | 4 ++-- .../simple_design/simple_design/tb/Makefile | 19 ++++++++++--------- .../simple_design/tb/run_cocotb_simulation.sh | 4 ++-- pytest.ini | 2 ++ tests/test_piel.py | 2 +- tests/visual/test_data_conversion.py | 6 +++--- 6 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 pytest.ini diff --git a/docs/examples/03_sax_basics.py b/docs/examples/03_sax_basics.py index cb12f99f..422f15dd 100644 --- a/docs/examples/03_sax_basics.py +++ b/docs/examples/03_sax_basics.py @@ -14,7 +14,7 @@ import piel import sax -gf.components() +dir(gf.components) # We create a balanced MZI lattice full of the same `mzi2x2_2x2` components to demonstrate `sax` network basics. @@ -102,7 +102,7 @@ # `piel` provides a library with a list of models, that we hope we can extend and improve with your contribution! We create our model dictionary accordingly based on our default photonic frequency library: -piel.models.frequency.photonic.get_default_models() +piel.models.frequency.get_default_models() # Let's explore one of our default models. Each model has its source in the documentation. diff --git a/docs/examples/designs/simple_design/simple_design/tb/Makefile b/docs/examples/designs/simple_design/simple_design/tb/Makefile index 94742fda..6304602b 100644 --- a/docs/examples/designs/simple_design/simple_design/tb/Makefile +++ b/docs/examples/designs/simple_design/simple_design/tb/Makefile @@ -1,9 +1,10 @@ -#!/bin/bash -# Makefile -SIM ?= icarus -TOPLEVEL_LANG ?= verilog -VERILOG_SOURCES += /foss/designs/piel/docs/examples/designs/simple_design/simple_design/src/adder.vhdl -VERILOG_SOURCES += /foss/designs/piel/docs/examples/designs/simple_design/simple_design/src/adder.sv -TOPLEVEL := adder -MODULE := test_adder -include $(shell cocotb-config --makefiles)/Makefile.sim \ No newline at end of file +#!/bin/bash +# Makefile +SIM ?= icarus +TOPLEVEL_LANG ?= verilog +VERILOG_SOURCES += C:\Users\dario\Documents\phd\piel\docs\examples\designs\simple_design\simple_design\src\.ipynb_checkpoints +VERILOG_SOURCES += C:\Users\dario\Documents\phd\piel\docs\examples\designs\simple_design\simple_design\src\adder.sv +VERILOG_SOURCES += C:\Users\dario\Documents\phd\piel\docs\examples\designs\simple_design\simple_design\src\adder.vhdl +TOPLEVEL := adder +MODULE := test_adder +include $(shell cocotb-config --makefiles)/Makefile.sim diff --git a/docs/examples/designs/simple_design/simple_design/tb/run_cocotb_simulation.sh b/docs/examples/designs/simple_design/simple_design/tb/run_cocotb_simulation.sh index 965d1a4e..f1c472e3 100644 --- a/docs/examples/designs/simple_design/simple_design/tb/run_cocotb_simulation.sh +++ b/docs/examples/designs/simple_design/simple_design/tb/run_cocotb_simulation.sh @@ -1,2 +1,2 @@ -cd /foss/designs/piel/docs/examples/designs/simple_design/simple_design/tb; -make \ No newline at end of file +cd C:\Users\dario\Documents\phd\piel\docs\examples\designs\simple_design\simple_design\tb; +make diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..1a441220 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +python_files = test_*.py 0*.py diff --git a/tests/test_piel.py b/tests/test_piel.py index ead94b6d..2c5b4df7 100644 --- a/tests/test_piel.py +++ b/tests/test_piel.py @@ -6,7 +6,7 @@ from click.testing import CliRunner -from piel import piel +import piel # NOQA: F401 from piel import cli diff --git a/tests/visual/test_data_conversion.py b/tests/visual/test_data_conversion.py index faed9fa4..7be171c1 100644 --- a/tests/visual/test_data_conversion.py +++ b/tests/visual/test_data_conversion.py @@ -5,7 +5,7 @@ print(test_data) -piel.append_row_to_dict(data=test_data, copy_index=1, set_value={"t": 10}) +piel.visual.append_row_to_dict(data=test_data, copy_index=1, set_value={"t": 10}) print(test_data) """ @@ -20,7 +20,7 @@ test_data = {"t": np.array([3000, 4000, 5000, 6000]), "x": np.array([2, 3, 4, 5])} -out_data = piel.points_to_lines_fixed_transient( +out_data = piel.visual.points_to_lines_fixed_transient( data=test_data, time_index_name="t", fixed_transient_time=1, @@ -316,7 +316,7 @@ print(test_data["t"]) -piel.points_to_lines_fixed_transient( +piel.visual.points_to_lines_fixed_transient( data=test_data, time_index_name="t", fixed_transient_time=1,