seitime-frappe/frappe/tests/utils/__init__.py
David Arnold 4000cba810
fix: compat FrappeTestCase (#28367)
due to circular imports issues and me going out of my way to make it work 'cleanly', the previous backwards compatibility for FrappeTestCase unfortunately did not work on the manual cli test runner 'run-tests'

While not generally not affecting CI (which is precedented by the framwork's best practices to use 'run-parallel-test'), this broke some manual developer workflows

The restauration of FrappeTestCase in these scenario now unfortunately involves a plain copy of almost an entire implementation into the dumpster.

On the one hand, this doesn not accurately reflect the rather minuscule differences between IntegrationTestCase and FrappeTestCase, but on the other hand, it shields and freezes the old api should IntegrationTestCase evolve futher
2024-11-05 18:16:22 +01:00

49 lines
1.1 KiB
Python

import logging
import frappe
logger = logging.Logger(__file__)
from .generators import *
def check_orpahned_doctypes():
"""Check that all doctypes in DB actually exist after patch test"""
from frappe.model.base_document import get_controller
doctypes = frappe.get_all("DocType", {"custom": 0}, pluck="name")
orpahned_doctypes = []
for doctype in doctypes:
try:
get_controller(doctype)
except ImportError:
orpahned_doctypes.append(doctype)
if orpahned_doctypes:
frappe.throw(
"Following doctypes exist in DB without controller.\n {}".format("\n".join(orpahned_doctypes))
)
from frappe.deprecation_dumpster import (
get_tests_CompatFrappeTestCase,
)
from frappe.deprecation_dumpster import (
tests_change_settings as change_settings,
)
from frappe.deprecation_dumpster import (
tests_debug_on as debug_on,
)
FrappeTestCase = get_tests_CompatFrappeTestCase()
from frappe.deprecation_dumpster import (
tests_patch_hooks as patch_hooks,
)
from frappe.deprecation_dumpster import (
tests_timeout as timeout,
)
from frappe.deprecation_dumpster import (
tests_utils_get_dependencies as get_dependencies,
)