I am getting a frappe.exceptions.LinkValidationError Error when trying to run the above command or a similar command with my own test: ‘bench run-tests --doctype “DOCTYPE”’
One thing I recognized is that this Error does only occur when the specified DocType has a Link Field. Otherwise, it works just fine. The command “bench run-tests --app frappe” works also just fine.
Any suggestions?
Here is the full Error:
frappe@erpnext_develop:~/frappe-bench$ bench run-tests --app erpnext Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module> main() File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main click.Group(commands=commands)(prog_name='bench') File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func ret = f(frappe._dict(ctx.obj), *args, **kwargs) File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 485, in run_tests ui_tests = ui_tests, doctype_list_path = doctype_list_path, failfast=failfast) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 72, in main ret = run_all_tests(app, verbose, profile, ui_tests, failfast=failfast, junit_xml_output=junit_xml_output) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 128, in run_all_tests test_suite, ui_tests) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 267, in _add_test make_test_records(doctype, verbose) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 284, in make_test_records make_test_records(options, verbose, force) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 284, in make_test_records make_test_records(options, verbose, force) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 284, in make_test_records make_test_records(options, verbose, force) [Previous line repeated 4 more times] File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 285, in make_test_records make_test_records_for_doctype(options, verbose, force) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 333, in make_test_records_for_doctype frappe.local.test_objects[doctype] += make_test_objects(doctype, test_module.test_records, verbose, force) File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 384, in make_test_objects d.insert() File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 224, in insert self._validate_links() File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 766, in _validate_links frappe.LinkValidationError) File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 377, in throw msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable) File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 356, in msgprint _raise_exception() File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 316, in _raise_exception raise raise_exception(msg) **frappe.exceptions.LinkValidationError:** Could not find Row #1: Cost Center: _Test Cost Center - _TC, Row #2: Cost Center: _Test Cost Center - _TC, Row #3: Cost Center: _Test Cost Center - _TC, Row #4: Cost Center: _Test Cost Center - _TC, Ro w #5: Cost Center: _Test Cost Center - _TC, Row #6: Cost Center: _Test Cost Center - _TC, Row #7: Cost Center: _Test Cos t Center - _TC, Row #8: Cost Center: _Test Cost Center - _TC