Unittest app error

I’m trying to run my app tests but I’m getting this error:

➜  frappe_docker git:(master) ✗ ./dbench run-tests --app nota_fiscal                        
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/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.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.5/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.5/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.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.5/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 419, 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 70, in main
    ret = run_all_tests(app, verbose, profile, ui_tests, failfast=failfast)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 112, in run_all_tests
    test_suite, ui_tests)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 240, in _add_test
    make_test_records(doctype, verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 257, in make_test_records
    make_test_records(options, verbose, force)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 257, in make_test_records
    make_test_records(options, verbose, force)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 257, in make_test_records
    make_test_records(options, verbose, force)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 258, in make_test_records
    make_test_records_for_doctype(options, verbose, force)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/test_runner.py", line 306, 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 343, in make_test_objects
    d.set_new_name()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 378, in set_new_name
    set_new_name(self)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/naming.py", line 39, in set_new_name
    doc.run_method("autoname")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 772, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1048, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1031, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 766, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/warehouse/warehouse.py", line 17, in autoname
    suffix = " - " + frappe.get_cached_value('Company',  self.company,  "abbr")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 706, in get_cached_value
    doc = get_cached_doc(doctype, name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 691, in get_cached_doc
    doc = get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 734, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 69, in get_doc
    return controller(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 104, in __init__
    self.load_from_db()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 141, in load_from_db
    frappe.throw(_("{0} {1} not found").format(_(self.doctype), self.name), frappe.DoesNotExistError)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 360, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red')
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 346, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 315, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Company _Test Company not found

Any help?

Hey,

Were you able to figure this out?

Thanks,
Palash

Hello,

same problem here, does anybody figured it out ?

Regards

Same Problem here!
Please fix :slight_smile:

If deleting the existing data is ok in your case and not an issue, run a bench reinstall - that might possibly return the database to a state where the tests might run?

New install of v10.x.x is Unable to Run "setup_wizard.js" - #5 by clarkej