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:
parent
4093f13067
commit
551be4f6ab
3 changed files with 7 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue