home · contact · privacy
On testing scripts insert resolution, don't insert any file more than once.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 10 Nov 2025 03:36:20 +0000 (04:36 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 10 Nov 2025 03:36:20 +0000 (04:36 +0100)
src/ircplom/testing.py

index a8026a9ce13e372690a73e82af4510ecef5a216b..b6efa6715f15d261cd7c829d2761883e6110faa6 100644 (file)
@@ -250,6 +250,9 @@ class _Playbook:
 
             assert len(insert_args) in (1, 2, 3, 5), (idx_str, insert_args)
             if len(insert_args) == 1 and insert_args[0].startswith(_TOK_FILE):
+                if insert_args[0] in inserted_files:
+                    return []
+                inserted_files.add(insert_args[0])
                 return lines_t_from_file(PATH_TESTS.joinpath(insert_args[0]),
                                          f'{idx_str}{_TOK_FILE}{_SEP_2}')
             candidates = [
@@ -265,6 +268,7 @@ class _Playbook:
             return [(c[0], c[1]) for c in candidates]
 
         self._lines_t = lines_t_from_file(path)
+        inserted_files: set[str] = set()
         while True:
             fragments: dict[str, tuple[tuple[str, str], ...]] = {}
             anchor = ''