Try ERPNext Buy Support Partners Foundation

Getting frappe.exceptions.LinkValidationError When running test

Hi,
When i am trying to run test only on my module with this command
bench --site test_dev_site --force --verbose run-tests --app international_design
i am getting this error
frappe.exceptions.LinkValidationError: Could not find Parent Supplier Group: All Supplier Groups

it seems that the erpnext tests are running even when i am adding --app {my_app_name} suffix.
my erpnext instance is setted up in French.
here is the full error message

` Running “before_tests” hooks
Making for Quality Inspection Template
Please setup make_test_records for: Quality Inspection Template
------------------------------------------------------------
Autoname: field:quality_inspection_template_name
Mandatory Fields:
Quality Inspection Template:quality_inspection_template_name | Data |
Quality Inspection Template:item_quality_inspection_parameter | Table | Item Quality Inspection Parameter

Making for Supplier Group
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/Users/sathouel/frappe/dev/idesign_bench/env/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/sathouel/frappe/dev/idesign_bench/env/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/sathouel/frappe/dev/idesign_bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/sathouel/frappe/dev/idesign_bench/env/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/sathouel/frappe/dev/idesign_bench/env/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/sathouel/frappe/dev/idesign_bench/env/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/sathouel/frappe/dev/idesign_bench/env/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/Users/sathouel/frappe/dev/idesign_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 "/Users/sathouel/frappe/dev/idesign_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 "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/test_runner.py", line 128, in run_all_tests
    test_suite, ui_tests)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/test_runner.py", line 267, in _add_test
    make_test_records(doctype, verbose)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/test_runner.py", line 284, in make_test_records
    make_test_records(options, verbose, force)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/test_runner.py", line 284, in make_test_records
    make_test_records(options, verbose, force)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/test_runner.py", line 285, in make_test_records
    make_test_records_for_doctype(options, verbose, force)
  File "/Users/sathouel/frappe/dev/idesign_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 "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/test_runner.py", line 384, in make_test_objects
    d.insert()
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/model/document.py", line 224, in insert
    self._validate_links()
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/model/document.py", line 763, in _validate_links
    frappe.LinkValidationError)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/__init__.py", line 377, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable)
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/__init__.py", line 356, in msgprint
    _raise_exception()
  File "/Users/sathouel/frappe/dev/idesign_bench/apps/frappe/frappe/__init__.py", line 316, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.LinkValidationError: Could not find Parent Supplier Group: All Supplier Groups`

Someone could help me please, I can’t go to production without testing my code :sweat_smile:
Thanks

You have a custom app international_design

Check for missing data or say this data is not loading?

frappe@ubuntu1804lts:~/frappe-bench$ find . -name ‘*.json’ | xargs grep ‘All Supplier Groups’
./apps/erpnext/erpnext/setup/doctype/supplier_group/test_records.json: “parent_supplier_group”: “All Supplier Groups”

Perhaps this a test setup dependency question, you may have to run erpnext tests first?

Thanks for your reply !
i figured it out by create new site then setted up in English then it works.
i think the problem was with the make_records of the erpnext doctype which refer to initial entries like All Customer Groups that i deleted in my production site.
So i can’t use exactly the same database as my production one (by reinstalling it within my test site)