diff --git a/frappe/commands/testing.py b/frappe/commands/testing.py index 10dd126ec3..4acc05c9f6 100644 --- a/frappe/commands/testing.py +++ b/frappe/commands/testing.py @@ -11,8 +11,6 @@ from frappe.commands import get_site, pass_context from frappe.utils.bench_helper import CliCtxObj if TYPE_CHECKING: - import unittest - from frappe.testing import TestRunner @@ -46,6 +44,9 @@ def main( discover_module_tests, ) from frappe.testing.environment import _cleanup_after_tests, _initialize_test_environment + from frappe.tests.utils.generators import _clear_test_log + + _clear_test_log() if debug and not debug_exceptions: debug_exceptions = (Exception,) @@ -275,7 +276,7 @@ def run_tests( site = get_site(context) frappe.init(site) - allow_tests = frappe.get_conf().allow_tests + allow_tests = frappe.conf.allow_tests if not (allow_tests or os.environ.get("CI")): click.secho("Testing is disabled for the site!", bold=True) diff --git a/frappe/tests/utils/generators.py b/frappe/tests/utils/generators.py index b49488ea81..b92364ea50 100644 --- a/frappe/tests/utils/generators.py +++ b/frappe/tests/utils/generators.py @@ -414,7 +414,7 @@ class TestRecordManager: temp_file.replace(self.log_file) -def _after_install_clear_test_log(): +def _clear_test_log(): log_file_path = frappe.get_site_path(PERSISTENT_TEST_LOG_FILE) if os.path.exists(log_file_path): os.remove(log_file_path) diff --git a/frappe/utils/install.py b/frappe/utils/install.py index 0e65258a45..195e9a4c0a 100644 --- a/frappe/utils/install.py +++ b/frappe/utils/install.py @@ -48,9 +48,9 @@ def after_install(): frappe.db.set_single_value("System Settings", "setup_complete", 0) # clear test log - from frappe.tests.utils.generators import _after_install_clear_test_log + from frappe.tests.utils.generators import _clear_test_log - _after_install_clear_test_log() + _clear_test_log() add_standard_navbar_items()