From 510f2e51acdf33d6679c858665ba0a646ddbbc88 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 13 Apr 2017 13:12:35 +0530 Subject: [PATCH] [test] check patch names --- .../v4_0/create_custom_field_for_owner_match.py | 2 +- frappe/tests/test_patches.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 frappe/tests/test_patches.py diff --git a/frappe/patches/v4_0/create_custom_field_for_owner_match.py b/frappe/patches/v4_0/create_custom_field_for_owner_match.py index 9a2b326a4a..11f8e46b62 100644 --- a/frappe/patches/v4_0/create_custom_field_for_owner_match.py +++ b/frappe/patches/v4_0/create_custom_field_for_owner_match.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe -from frappe.core.doctype.custom_field.custom_field import create_custom_field +from frappe.custom.doctype.custom_field.custom_field import create_custom_field def execute(): if "match" in frappe.db.get_table_columns("DocPerm"): diff --git a/frappe/tests/test_patches.py b/frappe/tests/test_patches.py new file mode 100644 index 0000000000..bdf58df8a1 --- /dev/null +++ b/frappe/tests/test_patches.py @@ -0,0 +1,16 @@ +import unittest, frappe +from frappe.modules import patch_handler + +class TestPatches(unittest.TestCase): + def test_patch_module_names(self): + frappe.flags.final_patches = [] + frappe.flags.in_install = True + for patchmodule in patch_handler.get_all_patches(): + if patchmodule.startswith("execute:"): + pass + else: + if patchmodule.startswith("finally:"): + patchmodule = patchmodule.split('finally:')[-1] + self.assertTrue(frappe.get_attr(patchmodule.split()[0] + ".execute")) + + frappe.flags.in_install = False