From 31bfaf768c492e9ada4de12c65d3875407314439 Mon Sep 17 00:00:00 2001 From: Donald Sebastian Leung Date: Fri, 18 Sep 2020 11:45:11 +0800 Subject: [PATCH] Add option to specify spec_name --- nmigen/test/utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nmigen/test/utils.py b/nmigen/test/utils.py index 29bd5b6..aa7b81d 100644 --- a/nmigen/test/utils.py +++ b/nmigen/test/utils.py @@ -53,14 +53,15 @@ class FHDLTestCase(unittest.TestCase): if msg is not None: self.assertEqual(str(warns[0].message), msg) - def assertFormal(self, spec, mode="bmc", depth=1, engine="smtbmc"): + def assertFormal(self, spec, mode="bmc", depth=1, engine="smtbmc", spec_name=None): caller, *_ = traceback.extract_stack(limit=2) spec_root, _ = os.path.splitext(caller.filename) spec_dir = os.path.dirname(spec_root) - spec_name = "{}_{}".format( - os.path.basename(spec_root).replace("test_", "spec_"), - caller.name.replace("test_", "") - ) + if spec_name is None: + spec_name = "{}_{}".format( + os.path.basename(spec_root).replace("test_", "spec_"), + caller.name.replace("test_", "") + ) # The sby -f switch seems not fully functional when sby is reading from stdin. if os.path.exists(os.path.join(spec_dir, spec_name)): -- 2.30.2