Skip to content

Test fails in containerized environment with clean_customized_doctypes #111

Description

@adamgranted

Expected Behavior

Running pre-commit run --all should complete without issue.

Actual Behavior

Running pre-commit run --all fails in a containerized environment with:

clean_customized_doctypes................................................Failed
- hook id: clean_customized_doctypes
- exit code: 1

Traceback (most recent call last):
  File "/home/frappeuser/.cache/pre-commit/repos_9wqowq/py_env-python3.12/bin/clean_customized_doctypes", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/frappeuser/.cache/pre-commit/repos_9wqowq/py_env-python3.12/lib/python3.12/site-packages/test_utils/pre_commit/clean_customized_doctypes.py", line 76, in main
    modified_files = validate_and_clean_customized_doctypes(customized_doctypes)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappeuser/.cache/pre-commit/repos_9wqowq/py_env-python3.12/lib/python3.12/site-packages/test_utils/pre_commit/clean_customized_doctypes.py", line 59, in validate_and_clean_customized_doctypes
    os.replace(temp_file_path, customize_file)
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmpiocgsndi' -> '/home/frappeuser/frappe-bench/apps/align/align/align/custom/project_template.json'

Proposed Fix

Replace os.replace() with shutil.move() in clean_customized_doctypes:59

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions