From 2cee670940a9d691f83aae1a28d71b309eb4d559 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Fri, 13 Sep 2024 11:52:05 +0200 Subject: [PATCH] tests: Enable pytest testing Use `pdm run pytest` to run all tests. --- lambdalib/tests/test_cores_i2c.py | 10 +++++----- lambdalib/tests/test_cores_regs.py | 4 ++-- lambdalib/tests/test_cores_spi.py | 12 ++++++------ lambdalib/tests/test_interface_stream.py | 4 ++-- pyproject.toml | 13 ++++++++++++- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/lambdalib/tests/test_cores_i2c.py b/lambdalib/tests/test_cores_i2c.py index 90b4aaf..e347175 100644 --- a/lambdalib/tests/test_cores_i2c.py +++ b/lambdalib/tests/test_cores_i2c.py @@ -3,11 +3,11 @@ from amaranth import * from amaranth.lib.io import Pin -from ..cores.i2c.stream import * -from ..cores.i2c.proto import * +from lambdalib.cores.i2c.stream import * +from lambdalib.cores.i2c.proto import * from amaranth.sim import * -from ..interface.stream_sim import * +from lambdalib.interface.stream_sim import * class I2C_Pins_Stub: @@ -104,6 +104,6 @@ def test_i2c_proto(): if __name__ == "__main__": - # test_i2c_stream_writer() - # test_i2c_stream() + test_i2c_stream_writer() + test_i2c_stream() test_i2c_proto() diff --git a/lambdalib/tests/test_cores_regs.py b/lambdalib/tests/test_cores_regs.py index b9bbaed..4b5cd69 100644 --- a/lambdalib/tests/test_cores_regs.py +++ b/lambdalib/tests/test_cores_regs.py @@ -3,8 +3,8 @@ from amaranth import * from amaranth.sim import * -from ..interface.stream_sim import * -from ..cores.regs import * +from lambdalib.interface.stream_sim import * +from lambdalib.cores.regs import * def test_regs(): diff --git a/lambdalib/tests/test_cores_spi.py b/lambdalib/tests/test_cores_spi.py index c93793a..a517964 100644 --- a/lambdalib/tests/test_cores_spi.py +++ b/lambdalib/tests/test_cores_spi.py @@ -7,15 +7,15 @@ from lambdasoc.soc.base import SoC from lambdasoc.periph.timer import * -from ..cores.spi.master import * -from ..cores.spi.slave import * -from ..cores.spi.bridge import * -from ..cores.spi.stream import * -from ..cores.spi.common import * +from lambdalib.cores.spi.master import * +from lambdalib.cores.spi.slave import * +from lambdalib.cores.spi.bridge import * +from lambdalib.cores.spi.stream import * +from lambdalib.cores.spi.common import * from amaranth.sim import * -from ..interface.stream_sim import * +from lambdalib.interface.stream_sim import * class MasterSlaveBench(Elaboratable): diff --git a/lambdalib/tests/test_interface_stream.py b/lambdalib/tests/test_interface_stream.py index a1ad596..d61e2eb 100644 --- a/lambdalib/tests/test_interface_stream.py +++ b/lambdalib/tests/test_interface_stream.py @@ -3,8 +3,8 @@ from amaranth import * from amaranth.sim import * -from ..interface.stream_sim import * -from ..interface.stream_utils import * +from lambdalib.interface.stream_sim import * +from lambdalib.interface.stream_utils import * def test_splitter(): diff --git a/pyproject.toml b/pyproject.toml index 4cd4089..e41c8ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,9 +6,11 @@ authors = [ {name = "Pierre-Olivier Vauboin", email = "po@lambdaconcept.com"}, ] dependencies = [ - "luna @ git+https://github.com/greatscottgadgets/luna.git", + "luna-usb @ git+https://github.com/greatscottgadgets/luna.git", + "amaranth @ git+https://github.com/amaranth-lang/amaranth@4d1c4fc20dc44398c09d334b7f34096b0185d43d", "amaranth-stdio @ git+https://github.com/amaranth-lang/amaranth-stdio@8ebce9bc535f96a0f479a53f1fa000bff71aceb8", "amaranth-boards @ git+https://github.com/amaranth-lang/amaranth-boards.git", + "amaranth-soc @ git+https://github.com/amaranth-lang/amaranth-soc@d66881d83419c689fc96168150e57d9f467723aa", ] requires-python = ">=3.9" readme = "README.md" @@ -19,3 +21,12 @@ requires = ["pdm-backend"] build-backend = "pdm.backend" [tool.pdm] + +[tool.pdm.dev-dependencies] +test = [ + "pdm[pytest]", + "pytest-cov", + "lambdasoc @ git+https://github.com/lambdaconcept/lambdasoc", + "minerva @ git+https://github.com/minerva-cpu/minerva", + "setuptools", +] \ No newline at end of file