def test_value_error_not_swallowed(self, workspace, mocker):
        mocker.patch(
            "django_codemod.path_utils.Path.resolve",
            side_effect=ValueError("something bad happened"),
        )

        with pytest.raises(ValueError):
            normalize_path(
                path=Path("example.py"),
                root=workspace,
            )
    def test_does_not_exist(self, workspace):
        normalized_path = normalize_path(
            path=Path("example.py"),
            root=workspace,
        )

        assert normalized_path == "example.py"
    def test_subdirectory(self, workspace):
        normalized_path = normalize_path(
            path=Path("example/one/file1.py"),
            root=workspace,
        )

        assert normalized_path == "example/one/file1.py"
    def test_basic(self, workspace):
        normalized_path = normalize_path(
            path=Path("example.py"),
            root=workspace,
        )

        assert normalized_path == "example.py"
    def test_symlink(self, workspace):
        with TemporaryDirectory() as temp_dir:
            file = workspace / "example.py"
            file.symlink_to(Path(temp_dir) / "other.py")

            normalized_path = normalize_path(
                path=Path("example.py"),
                root=workspace,
            )

            assert normalized_path is None
    def test_os_error(self, workspace, mocker):
        mocker.patch(
            "django_codemod.path_utils.Path.resolve",
            side_effect=OSError("something bad happened"),
        )
        normalized_path = normalize_path(
            path=Path("example.py"),
            root=workspace,
        )

        assert normalized_path is None