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

Added more patch files

parent 31349910
No related branches found
No related tags found
1 merge request!38E3-233: Add tests
......@@ -9,6 +9,7 @@ from .utils import *
TEST_DATA = Path(__file__).absolute().parent / "data"
MODULE_VERSION = "0.0.0+0"
MODULE_VERSION_NO_BUILD = "0.0.0"
DB_FILE = """record(ai, "TEST") {
......@@ -28,6 +29,12 @@ index 1806ff6..8701832 100644
"""
def create_patch_file(path, desc):
path.parent.mkdir(parents=True, exist_ok=True)
with open(path, "w") as f:
f.write(PATCH_FILE.format(desc=desc))
@pytest.mark.parametrize(
"wrapper",
[{"templates": "database.db", "sources": "", "dbds": "", "headers": ""}],
......@@ -38,10 +45,12 @@ def test_patch(wrapper):
with open(db_path, "w") as f:
f.write(DB_FILE)
patch_path = wrapper / "patch" / "Site" / MODULE_VERSION / "apply.p0.patch"
patch_path.parent.mkdir(parents=True)
with open(patch_path, "w") as f:
f.write(PATCH_FILE.format(desc="OK"))
patch_dir = wrapper / "patch" / "Site"
create_patch_file(patch_dir / MODULE_VERSION / "apply.p0.patch", "OK")
create_patch_file(
patch_dir / MODULE_VERSION_NO_BUILD / "dont-apply.p0.patch", "Bad"
)
create_patch_file(patch_dir / (MODULE_VERSION + "-dont-apply.p0.patch"), "Bad")
rc, outs, _ = run_make(
wrapper,
......@@ -58,5 +67,6 @@ def test_patch(wrapper):
assert 'field(DESC, "OK")' in db_contents
assert not "Bad" in db_contents
run_make(wrapper, "build", __DEBUG_VERSION=MODULE_VERSION)
rc, _, _ = run_make(wrapper, "build", __DEBUG_VERSION=MODULE_VERSION)
assert rc == 0
assert any((wrapper / TEST_MODULE_NAME).glob("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