From 50d569ba27d2c1bdbb4d8f1daabd4088e4c13fc6 Mon Sep 17 00:00:00 2001 From: Lev Vereshchagin Date: Fri, 17 Dec 2021 12:02:40 +0300 Subject: [PATCH] Print .env in tests, if version is develop, change to latest (for tag) --- tests/main.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/main.py b/tests/main.py index 2852be78..1c413255 100644 --- a/tests/main.py +++ b/tests/main.py @@ -96,14 +96,23 @@ def docker_compose(*cmd: str): @log("Setup .env") def setup_env(): shutil.copy("example.env", "tests/.env") - if CI: - with open("tests/.env", "a") as f: - f.write( - f""" -FRAPPE_VERSION={os.getenv("FRAPPE_VERSION")} -ERPNEXT_VERSION={os.getenv("ERPNEXT_VERSION")} + if not CI: + return + frappe_version = os.getenv("FRAPPE_VERSION") + if frappe_version == "develop": + frappe_version = "latest" + erpnext_version = os.getenv("ERPNEXT_VERSION") + if erpnext_version == "develop": + erpnext_version = "latest" + with open("tests/.env", "a") as f: + f.write( + f""" +FRAPPE_VERSION={frappe_version} +ERPNEXT_VERSION={erpnext_version} """ - ) + ) + with open("tests/.env") as f: + print(f.read()) @log("Print compose configuration")