fix: Clear site test records log before running test

Not sure if this was intentional - there is no documentation as far as i
can tell
This commit is contained in:
Gavin D'souza 2025-04-15 18:28:21 +02:00
parent 4093f13067
commit 551be4f6ab
No known key found for this signature in database
GPG key ID: 5413A43FBD450A34
3 changed files with 7 additions and 6 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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()