tests: make spec directory name unique per test method.
authoranuejn <jarohabiger@googlemail.com>
Thu, 22 Oct 2020 21:38:44 +0000 (23:38 +0200)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 15:15:34 +0000 (15:15 +0000)
tests/utils.py

index 9f2282f6ecc214c360cc8f6a74acc754914d4b5d..6a50df0399cee3525b819fdb422393650a87e278 100644 (file)
@@ -28,7 +28,12 @@ class FHDLTestCase(unittest.TestCase):
         self.assertEqual(prepare_repr(repr(obj)), prepare_repr(repr_str))
 
     def assertFormal(self, spec, mode="bmc", depth=1):
-        caller, *_ = traceback.extract_stack(limit=2)
+        stack = traceback.extract_stack()
+        for frame in reversed(stack):
+            if os.path.dirname(__file__) not in frame.filename:
+                break
+            caller = frame
+
         spec_root, _ = os.path.splitext(caller.filename)
         spec_dir = os.path.dirname(spec_root)
         spec_name = "{}_{}".format(