From 328f30b38d0b46c8ffdf0ebc83f7175305dd1ea9 Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Tue, 22 Mar 2022 11:28:04 +0100
Subject: [PATCH] Test runtime loading of recursive dependency

---
 tests/test_build.py | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/tests/test_build.py b/tests/test_build.py
index 95b5ae98..2467f2fa 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -169,8 +169,10 @@ def test_recursive_deps(wrappers):
 
     cell_path = wrapper_a.path / "cellMods"
 
-    wrapper_a.add_var_to_config_module(f"{wrapper_b.name}_DEP_VERSION", "0.0.0+0")
-    wrapper_b.add_var_to_config_module(f"{wrapper_c.name}_DEP_VERSION", "0.0.0+0")
+    module_version = "0.0.0+0"
+
+    wrapper_b.add_var_to_config_module(f"{wrapper_c.name}_DEP_VERSION", module_version)
+    wrapper_a.add_var_to_config_module(f"{wrapper_b.name}_DEP_VERSION", module_version)
 
     wrapper_c.add_var_to_makefile("HEADERS", f"{wrapper_c.name}.h")
     (wrapper_c.module_dir / f"{wrapper_c.name}.h").touch()
@@ -179,9 +181,21 @@ def test_recursive_deps(wrappers):
     with open(wrapper_a.module_dir / f"{wrapper_a.name}.c", "w") as f:
         f.write(f'#include "{wrapper_c.name}.h"')
 
-    rc, *_ = wrapper_c.run_make("cellinstall", cell_path=cell_path)
+    rc, *_ = wrapper_c.run_make(
+        "cellinstall", module_version=module_version, cell_path=cell_path
+    )
+    assert rc == 0
+    rc, *_ = wrapper_b.run_make(
+        "cellinstall", module_version=module_version, cell_path=cell_path
+    )
     assert rc == 0
-    rc, *_ = wrapper_b.run_make("cellinstall", cell_path=cell_path)
+    rc, *_ = wrapper_a.run_make(
+        "cellinstall", module_version=module_version, cell_path=cell_path
+    )
     assert rc == 0
-    rc, *_ = wrapper_a.run_make("cellinstall", cell_path=cell_path)
+
+    rc, outs, _ = run_ioc_get_output(
+        wrapper_a.name, module_version, wrapper_a.path / "cellMods"
+    )
     assert rc == 0
+    assert f"Loaded {wrapper_c.name} version {module_version}" in outs
-- 
GitLab