mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
PY-82326: Preparation for it (WIP): support ExecError for targets.
SSH is now target-based and we can't use `EelPath` with it. So we now have two types of `ExecError.exe`. Test is going to be created as next commit GitOrigin-RevId: 6bc56eb9770caeb7ba32c8f43e6f374fcf5a3325
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4dc8c380e3
commit
4964cc3a7d
@@ -85,7 +85,7 @@ private suspend fun EelExecutableProcess.run(): PyExecResult<EelProcess> {
|
||||
|
||||
private fun EelExecutableProcess.failAsCantStart(executeProcessError: ExecuteProcessException): Result.Failure<ExecError> {
|
||||
return ExecError(
|
||||
exe = exe,
|
||||
exe = Exe.OnEel(exe),
|
||||
args = args.toTypedArray(),
|
||||
additionalMessageToUser = PyExecBundle.message("py.exec.start.error", description, executeProcessError.message, executeProcessError.errno),
|
||||
errorReason = ExecErrorReason.CantStart(executeProcessError.errno, executeProcessError.message)
|
||||
@@ -96,7 +96,7 @@ private suspend fun EelExecutableProcess.killProcessAndFailAsTimeout(eelProcess:
|
||||
eelProcess.kill()
|
||||
|
||||
return ExecError(
|
||||
exe = exe,
|
||||
exe = Exe.OnEel( exe),
|
||||
args = args.toTypedArray(),
|
||||
additionalMessageToUser = PyExecBundle.message("py.exec.timeout.error", description, timeout),
|
||||
errorReason = ExecErrorReason.Timeout
|
||||
@@ -109,7 +109,7 @@ private fun EelExecutableProcess.failAsExecutionFailed(processOutput: ExecErrorR
|
||||
}
|
||||
|
||||
return ExecError(
|
||||
exe = exe,
|
||||
exe = Exe.OnEel(exe),
|
||||
args = args.toTypedArray(),
|
||||
additionalMessageToUser = additionalMessage,
|
||||
errorReason = processOutput
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.platform.testFramework.junit5.eel.params.api.TestApplication
|
||||
import com.intellij.python.community.execService.*
|
||||
import com.intellij.testFramework.common.timeoutRunBlocking
|
||||
import com.jetbrains.python.Result
|
||||
import com.jetbrains.python.errorProcessing.Exe
|
||||
import com.jetbrains.python.errorProcessing.ExecError
|
||||
import com.jetbrains.python.getOrThrow
|
||||
import kotlinx.coroutines.*
|
||||
@@ -195,7 +196,7 @@ class ExecServiceShowCaseTest {
|
||||
is Result.Failure -> {
|
||||
assertFalse(sunny, "Unexpected failure ${result.error}")
|
||||
assertThat("Wrong message to user", result.error.message, CoreMatchers.containsString(messageToUser))
|
||||
assertEquals(shell, (result.error as ExecError).exe.asNioPath(), "Wrong exe")
|
||||
assertEquals(shell, (result.error.exe as Exe.OnEel).eelPath.asNioPath(), "Wrong exe")
|
||||
}
|
||||
is Result.Success -> {
|
||||
assertTrue(sunny, "Unexpected success")
|
||||
@@ -213,7 +214,7 @@ class ExecServiceShowCaseTest {
|
||||
is Result.Success -> fail("Execution of bad command should lead to an error")
|
||||
is Result.Failure -> {
|
||||
val err = (output.error as ExecError)
|
||||
assertEquals(binary, err.exe.asNioPath(), "Wrong command reported")
|
||||
assertEquals(binary, (err.exe as Exe.OnEel).eelPath.asNioPath(), "Wrong command reported")
|
||||
assertEquals("foo", err.args[0], "Wrong args reported")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user