[python] get real temp dir paths in test (PY-60410)

on MacOS X there is a symlink /private/var to /var. TempDir fixture returns a path without it, i.e. "/var/....". But the real path is "/private/var/...".

GitOrigin-RevId: 58b14d9ebe565396cb5e0acb5ee00795ac4e459e
This commit is contained in:
Vitaly Legchilkin
2025-02-12 19:19:40 +01:00
committed by intellij-monorepo-bot
parent f4417e0055
commit 10c1a56720

View File

@@ -12,6 +12,7 @@ import com.jetbrains.python.errorProcessing.PyError
import com.jetbrains.python.errorProcessing.PyError.ExecException
import io.github.z4kn4fein.semver.Version
import io.github.z4kn4fein.semver.VersionFormatException
import java.nio.file.Path
/**
* Handles hatch-specific errors, runs [transformer] only on outputs with codes 0 or 1 without tracebacks.
@@ -143,7 +144,7 @@ class HatchCli(private val runtime: HatchRuntime) {
*/
fun shell(): Result<Unit, ExecException> = TODO()
data class HatchStatus(val project: String, val location: String, val config: String)
data class HatchStatus(val project: String, val location: Path, val config: Path)
/**
* Show information about the current environment
@@ -153,7 +154,12 @@ class HatchCli(private val runtime: HatchRuntime) {
return runtime.executeAndMatch("status", expectedOutput = expectedOutput, outputContentSupplier = { it.stderr }) { matchResult ->
val (project, location, config) = matchResult.destructured
Result.success(HatchStatus(project, location, config))
try {
Result.success(HatchStatus(project, Path.of(location), Path.of(config)))
}
catch (e: Exception) {
Result.failure(e.localizedMessage)
}
}
}