diff --git a/tests/conftest.py b/tests/conftest.py index b78ea835ab16e17bd9bfe4b1a5795da0cc4c35cc..1f9a531387023a28ee1af2eb6023151f14d56c44 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,6 +24,9 @@ class Wrapper: self.config_dir = self.path / "configure" self.config_dir.mkdir() + self.config_module = self.path / "CONFIG_MODULE" + self.config_module.touch() + self.makefile = self.path / f"{name}.Makefile" makefile_contents = f""" @@ -34,6 +37,8 @@ E3_MODULE_VERSION?=0.0.0+0 E3_MODULE_SRC_PATH:={module_path} E3_MODULE_MAKEFILE:={name}.Makefile +include $(TOP)/CONFIG_MODULE + include $(REQUIRE_CONFIG)/CONFIG include $(REQUIRE_CONFIG)/RULES_SITEMODS """ @@ -62,6 +67,10 @@ include $(E3_REQUIRE_TOOLS)/driver.makefile for var, value in config_vars.items(): f.write(f"{var} = {value}\n") + def add_var_to_config_module(self, makefile_var: str, value: str, modifier="+"): + with open(self.config_module, "a") as f: + f.write(f"{makefile_var} {modifier}= {value}\n") + def add_var_to_makefile(self, makefile_var: str, value: str, modifier="+"): with open(self.makefile, "a") as f: f.write(f"{makefile_var} {modifier}= {value}\n") diff --git a/tests/test_build.py b/tests/test_build.py index e66ed7ca869ae3aa5e80037eb4377afd1eca113a..d3e2c9df7449892b83e0f21b66283c1911ae2414 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -88,11 +88,11 @@ def test_missing_source_file(wrapper): def test_missing_requirement(wrapper): - wrapper.add_var_to_makefile("REQUIRED", "foo") + wrapper.add_var_to_config_module("FOO_DEP_VERSION", "bar") rc, _, errs = wrapper.run_make("build") - assert rc == 2 - assert "REQUIRED module 'foo' version '' does not exist" in errs + assert rc == 0 + assert 'Invalid dependency "FOO_DEP_VERSION"; pruning' in errs def test_header_install_location(wrapper): @@ -125,9 +125,8 @@ def test_updated_dependencies(wrappers): old_version = "0.0.0+0" - wrapper_main.add_var_to_makefile("REQUIRED", wrapper_dep.name) - wrapper_main.add_var_to_makefile( - f"{wrapper_dep.name}_VERSION", old_version, modifier="" + wrapper_main.add_var_to_config_module( + f"{wrapper_dep.name}_DEP_VERSION", old_version, modifier="" ) rc, *_ = wrapper_dep.run_make( @@ -149,8 +148,8 @@ def test_updated_dependencies(wrappers): ) assert rc == 0 - wrapper_main.add_var_to_makefile( - f"{wrapper_dep.name}_VERSION", new_version, modifier="" + wrapper_main.add_var_to_config_module( + f"{wrapper_dep.name}_DEP_VERSION", new_version, modifier="" ) rc, *_ = wrapper_main.run_make("cellinstall", module_version=new_version)