ERPNext Test Failing Even When I Exclude

I am trying to run tests for my app but it is failing, and what’s strange is, the failure is related to erpnext even though I am specifying the app name as part of the command.

My questions are:

  1. Anyone know why the tests in erpnext are still running even though I only want the ones in my custom app to run.
  2. Any advice on how maybe I can fix the failure in erpnext so I can run a complete system wide test?

Here is what I am running with the hopes of only running for my custom app:

bench run-tests --app myapp

This is what it returns:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/work/frappe/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/work/frappe/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/work/frappe/env/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/env/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/work/frappe/env/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/env/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/env/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/env/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/env/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/apps/frappe/frappe/commands/utils.py", line 790, in run_tests
    ret = frappe.test_runner.main(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 111, in main
    ret = run_all_tests(app, verbose, profile, failfast=failfast, junit_xml_output=junit_xml_output)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 162, in run_all_tests
    _add_test(app, path, filename, verbose, test_suite)
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 328, in _add_test
    make_test_records(doctype, verbose, commit=True)
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 343, in make_test_records
    make_test_records(options, verbose, force, commit=commit)
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 343, in make_test_records
    make_test_records(options, verbose, force, commit=commit)
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 343, in make_test_records
    make_test_records(options, verbose, force, commit=commit)
  [Previous line repeated 2 more times]
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 344, in make_test_records
    make_test_records_for_doctype(options, verbose, force, commit=commit)
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 398, in make_test_records_for_doctype
    frappe.local.test_objects[doctype] += make_test_objects(
                                          ^^^^^^^^^^^^^^^^^^
  File "/work/frappe/apps/frappe/frappe/test_runner.py", line 457, in make_test_objects
    d.insert(ignore_if_duplicate=True)
  File "/work/frappe/apps/frappe/frappe/model/document.py", line 283, in insert
    self._validate_links()
  File "/work/frappe/apps/frappe/frappe/model/document.py", line 930, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg), frappe.LinkValidationError)
  File "/work/frappe/apps/frappe/frappe/__init__.py", line 658, in throw
    msgprint(
  File "/work/frappe/apps/frappe/frappe/__init__.py", line 623, in msgprint
    _raise_exception()
  File "/work/frappe/apps/frappe/frappe/__init__.py", line 574, in _raise_exception
    raise exc
frappe.exceptions.LinkValidationError: Could not find Row #1: Company: _Test Company, Row #1: Default Account: _Test Payable USD - _TC