Skip to content
Snippets Groups Projects
Commit f733dc75 authored by Simon Rose's avatar Simon Rose
Browse files

Added failing test for E3-286

parent 1aa29fcc
No related branches found
No related tags found
1 merge request!73E3-286: module dep file recreation
repos: repos:
- repo: https://github.com/ambv/black - repo: https://github.com/ambv/black
rev: 21.11b1 rev: 21.12b0
hooks: hooks:
- id: black - id: black
- repo: https://gitlab.com/PyCQA/flake8 - repo: https://gitlab.com/PyCQA/flake8
......
...@@ -50,13 +50,14 @@ include $(E3_REQUIRE_TOOLS)/driver.makefile ...@@ -50,13 +50,14 @@ include $(E3_REQUIRE_TOOLS)/driver.makefile
def add_file(self, name): def add_file(self, name):
(self.module_dir / name).touch() (self.module_dir / name).touch()
def add_to_makefile(self, makefile_var, name): def add_to_makefile(self, makefile_var, value, modifier="+"):
assert modifier in ["", "+", "?", ":", "!"]
with open(self.makefile, "a") as f: with open(self.makefile, "a") as f:
f.write(f"{makefile_var} += {name}\n") f.write(f"{makefile_var} {modifier}= {value}\n")
@pytest.fixture @pytest.fixture
def wrappers(tmpdir, request): def wrappers(tmpdir):
class WrapperFactory: class WrapperFactory:
def get(self, **kwargs): def get(self, **kwargs):
return Wrapper(Path(tmpdir), **kwargs) return Wrapper(Path(tmpdir), **kwargs)
......
import re import re
from pathlib import Path from pathlib import Path
from .utils import get_env_var, run_make from .utils import get_env_var, run_ioc_get_output, run_make
MODULE_VERSION = "0.0.0+0" MODULE_VERSION = "0.0.0+0"
MODULE_VERSION_NO_BUILD = "0.0.0" MODULE_VERSION_NO_BUILD = "0.0.0"
...@@ -116,3 +116,51 @@ def test_header_install_location(wrapper): ...@@ -116,3 +116,51 @@ def test_header_install_location(wrapper):
for ext in extensions: for ext in extensions:
assert (Path(cell_path) / "include" / "subdir" / f"header.{ext}").is_file() assert (Path(cell_path) / "include" / "subdir" / f"header.{ext}").is_file()
assert not (Path(cell_path) / "include" / f"header.{ext}").is_file() assert not (Path(cell_path) / "include" / f"header.{ext}").is_file()
def test_updated_dependencies(wrappers):
wrapper_dep = wrappers.get()
wrapper_main = wrappers.get()
cell_path = wrapper_main.path / "cellMods"
old_version = "0.0.0+0"
wrapper_main.add_to_makefile("REQUIRED", wrapper_dep.name)
wrapper_main.add_to_makefile(
f"{wrapper_dep.name}_VERSION", old_version, modifier=""
)
rc, *_ = run_make(
wrapper_dep,
"cellinstall",
E3_CELL_PATH=cell_path,
E3_MODULE_VERSION=old_version,
)
assert rc == 0
rc, *_ = run_make(wrapper_main, "cellinstall", E3_MODULE_VERSION=old_version)
assert rc == 0
new_version = "1.0.0+0"
rc, *_ = run_make(
wrapper_dep,
"cellinstall",
E3_CELL_PATH=cell_path,
E3_MODULE_VERSION=new_version,
)
assert rc == 0
wrapper_main.add_to_makefile(
f"{wrapper_dep.name}_VERSION", new_version, modifier=""
)
rc, *_ = run_make(wrapper_main, "cellinstall", E3_MODULE_VERSION=new_version)
assert rc == 0
rc, o, _ = run_ioc_get_output(
wrapper_main.name, new_version, wrapper_main.path / "cellMods"
)
assert rc == 0
assert f"Loaded {wrapper_dep.name} version {new_version}" in o
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment