Skip to content

Broken tests #4121

@SamarthKuchya

Description

@SamarthKuchya

Information about bug

On running command bench --site hrms.localhost run-tests --app hrms
This command is used to run all the tests. So i ran this but i was getting error it was during the execution of tests it didn't created a test company so test are failing.

Image Image

Module

HR

Version

Frappe version - 16
HRMS version - 16

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

samarth@unknown:~/Desktop/frappe-bench$ bench --site hrms.localhost run-tests --app hrms
Starting test run with parameters: site=hrms.localhost, app=hrms, verbose=False, tests=(), force=False, profile=False, failfast=False, skip_before_tests=False, debug=False, selected_categories=[]
View detailed logs (using --verbose): /home/samarth/Desktop/frappe-bench/logs/frappe.testing.log
Traceback (most recent call last):
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 48, in invoke
    return super().invoke(ctx)
           ~~~~~~~~~~~~~~^^^^^
  File "/home/samarth/Desktop/frappe-bench/env/lib/python3.14/site-packages/click/core.py", line 1873, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/samarth/Desktop/frappe-bench/env/lib/python3.14/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samarth/Desktop/frappe-bench/env/lib/python3.14/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "/home/samarth/Desktop/frappe-bench/env/lib/python3.14/site-packages/click/decorators.py", line 34, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 28, in _func
    ret = f(ctx.obj, *args, **kwargs)
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/commands/testing.py", line 342, in run_tests
    main(
    ~~~~^
    	site,
     ^^^^^
    ...<15 lines>...
    	lightmode=lightmode,
     ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/commands/testing.py", line 162, in main
    for app, category, suite in runner.iterRun():
                                ~~~~~~~~~~~~~~^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/testing/runner.py", line 87, in iterRun
    self._prepare_category(category, suite, app)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/testing/runner.py", line 107, in _prepare_category
    prepare_method(suite, app, category)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/testing/environment.py", line 182, in __call__
    self._run_before_test_hooks(app, category)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/testing/utils.py", line 12, in wrapper
    result = func(*args, **kwargs)
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/testing/environment.py", line 195, in _run_before_test_hooks
    frappe.get_attr(hook_function)()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/samarth/Desktop/hrms/hrms/tests/test_utils.py", line 36, in before_tests
    set_defaults()
    ~~~~~~~~~~~~^^
  File "/home/samarth/Desktop/hrms/hrms/tests/test_utils.py", line 48, in set_defaults
    create_holiday_list_assignment("Company", "_Test Company", "Salary Slip Test Holiday List")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samarth/Desktop/hrms/hrms/hr/doctype/holiday_list_assignment/test_holiday_list_assignment.py", line 106, in create_holiday_list_assignment
    hla.save()
    ~~~~~~~~^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/model/document.py", line 518, in save
    return self._save(*args, **kwargs)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/model/document.py", line 540, in _save
    return self.insert()
           ~~~~~~~~~~~^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/model/document.py", line 440, in insert
    self._validate_links()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/model/document.py", line 1145, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg), frappe.LinkValidationError)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/utils/messages.py", line 148, in throw
    msgprint(
    ~~~~~~~~^
    	msg,
     ^^^^
    ...<6 lines>...
    	primary_action=primary_action,
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/utils/messages.py", line 109, in msgprint
    _raise_exception()
    ~~~~~~~~~~~~~~~~^^
  File "/home/samarth/Desktop/frappe-bench/apps/frappe/frappe/utils/messages.py", line 58, in _raise_exception
    raise exc
frappe.exceptions.LinkValidationError: Could not find Employee Company: _Test Company, Assigned To: _Test Company

Could not find Employee Company: _Test Company, Assigned To: _Test Company

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions