diff --git a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/manage/ExternalProjectsDataStorageTest.kt b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/manage/ExternalProjectsDataStorageTest.kt index ba4c5091a6d3..8ae4f0ce8f78 100644 --- a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/manage/ExternalProjectsDataStorageTest.kt +++ b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/manage/ExternalProjectsDataStorageTest.kt @@ -13,6 +13,8 @@ import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import kotlinx.coroutines.runBlocking import org.assertj.core.api.BDDAssertions.then import org.junit.Test +import kotlin.io.path.createTempDirectory +import kotlin.io.path.invariantSeparatorsPathString import kotlin.reflect.jvm.jvmName class ExternalProjectsDataStorageTest: UsefulTestCase() { @@ -43,7 +45,10 @@ class ExternalProjectsDataStorageTest: UsefulTestCase() { val testSystemId = ProjectSystemId("Test") val externalName = "external_name" val externalProjectInfo = createExternalProjectInfo( - testSystemId, externalName, FileUtil.toSystemIndependentName(createTempDir(suffix = externalName).canonicalPath)) + testSystemId, + externalName, + createTempDirectory(externalName).invariantSeparatorsPathString + ) dataStorage.update(externalProjectInfo) dataStorage.save() @@ -60,13 +65,23 @@ class ExternalProjectsDataStorageTest: UsefulTestCase() { val testSystemId = ProjectSystemId("Test") val externalName1 = "external_name1" - dataStorage.update(createExternalProjectInfo( - testSystemId, externalName1, FileUtil.toSystemIndependentName(createTempDir(suffix = externalName1).canonicalPath))) + dataStorage.update( + createExternalProjectInfo( + testSystemId, + externalName1, + createTempDirectory(externalName1).invariantSeparatorsPathString + ) + ) dataStorage.load() val externalName2 = "external_name2" - dataStorage.update(createExternalProjectInfo( - testSystemId, externalName2, FileUtil.toSystemIndependentName(createTempDir(suffix = externalName2).canonicalPath))) + dataStorage.update( + createExternalProjectInfo( + testSystemId, + externalName2, + createTempDirectory(externalName2).invariantSeparatorsPathString + ) + ) val list = dataStorage.list(testSystemId) then(list).hasSize(2) diff --git a/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/JdkDownloaderStoreTest.kt b/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/JdkDownloaderStoreTest.kt index 50a3aebca344..94055caa52f1 100644 --- a/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/JdkDownloaderStoreTest.kt +++ b/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/JdkDownloaderStoreTest.kt @@ -5,12 +5,13 @@ import com.intellij.openapi.components.reloadApplicationState import com.intellij.openapi.components.service import com.intellij.testFramework.LightPlatformTestCase import org.junit.Assert +import kotlin.io.path.createTempDirectory class JdkDownloaderStoreTest : LightPlatformTestCase() { fun testState() { val item1 = jdkItemForTest("urk-1", JdkPackageType.ZIP, 123, "sha-1") val item2 = jdkItemForTest("urk-2", JdkPackageType.ZIP, 432, "sha-2") - val path1 = createTempDir("path-1").toPath() + val path1 = createTempDirectory("path-1") service.registerInstall(item1, path1) Assert.assertEquals(listOf(path1), service.findInstallations(item1).toList()) diff --git a/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/SdkDownloaderTest.kt b/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/SdkDownloaderTest.kt index b100ea4785c1..629165f7fe49 100644 --- a/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/SdkDownloaderTest.kt +++ b/platform/lang-impl/testSources/com/intellij/openapi/projectRoots/impl/jdkDownloader/SdkDownloaderTest.kt @@ -23,11 +23,12 @@ import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicReference import kotlin.concurrent.thread +import kotlin.io.path.createTempDirectory import kotlin.io.path.invariantSeparatorsPathString class SdkDownloaderTest : LightPlatformTestCase() { private val successDownloadTask = object : SdkDownloadTask { - val home = createTempDir("planned-home").toPath().invariantSeparatorsPathString + val home = createTempDirectory("planned-home").invariantSeparatorsPathString override fun getPlannedHomeDir() = home override fun getSuggestedSdkName() = "suggested name" override fun getPlannedVersion() = "planned version" diff --git a/platform/lang-impl/testSources/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModelTest.kt b/platform/lang-impl/testSources/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModelTest.kt index 203e48818855..31e51da4cef7 100644 --- a/platform/lang-impl/testSources/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModelTest.kt +++ b/platform/lang-impl/testSources/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModelTest.kt @@ -17,6 +17,9 @@ import com.intellij.util.Consumer import com.intellij.util.ui.UIUtil import org.junit.Assert import org.junit.Test +import kotlin.io.path.absolute +import kotlin.io.path.createTempDirectory +import kotlin.io.path.pathString class ProjectSdksModelTest : LightPlatformTestCase() { private val model = ProjectSdksModel() @@ -71,7 +74,7 @@ class ProjectSdksModelTest : LightPlatformTestCase() { private inner class DownloadSdkTest { val type = SimpleJavaSdkType.getInstance() - val plannedDir = createTempDir("planned-dir-") + val plannedDir = createTempDirectory("planned-dir-").absolute() val sdkName = "test-name" fun task(action: () -> Unit) { @@ -94,7 +97,7 @@ class ProjectSdksModelTest : LightPlatformTestCase() { try { model.setupInstallableSdk(type, object : SdkDownloadTask { override fun getSuggestedSdkName() = sdkName - override fun getPlannedHomeDir() = plannedDir.absolutePath + override fun getPlannedHomeDir() = plannedDir.pathString override fun getPlannedVersion() = "1.2.3" override fun doDownload(indicator: ProgressIndicator) { ApplicationManager.getApplication().assertIsNonDispatchThread() diff --git a/python/testSrc/com/jetbrains/env/python/testing/PythonTrialTest.kt b/python/testSrc/com/jetbrains/env/python/testing/PythonTrialTest.kt index 533a2c1024d4..377b33bb6d4f 100644 --- a/python/testSrc/com/jetbrains/env/python/testing/PythonTrialTest.kt +++ b/python/testSrc/com/jetbrains/env/python/testing/PythonTrialTest.kt @@ -22,8 +22,9 @@ import com.jetbrains.python.testing.PyTrialTestFactory import com.jetbrains.python.testing.PythonTestConfigurationType import org.junit.Assert import org.junit.Test -import java.io.File import java.util.function.Function +import kotlin.io.path.createTempDirectory +import kotlin.io.path.pathString // Twisted trial test case @EnvTestTagsRequired(tags = ["twisted"]) @@ -56,6 +57,6 @@ class PyTrialTestProcessRunner(scriptName: String, PyTrialTestFactory(PythonTestConfigurationType.getInstance()), PyTrialTestConfiguration::class.java, scriptName, timesToRerunFailedTests) { override fun configurationCreatedAndWillLaunch(configuration: PyTrialTestConfiguration) { super.configurationCreatedAndWillLaunch(configuration) - configuration.additionalArguments = "--temp-directory=" + File(createTempDir(), "trial").path + configuration.additionalArguments = "--temp-directory=" + createTempDirectory().resolve("trial").pathString } }