Files
openide/python/helpers/tests/build.gradle.kts
Pavel Karateev 1339dd72a3 PCQA-503 Use Path instead of File
GitOrigin-RevId: 3b5e3330b709a8cdc3be9e92a7c0d182d17473d5
2024-09-06 14:56:57 +00:00

45 lines
1.6 KiB
Kotlin

import org.apache.tools.ant.taskdefs.condition.Os
import java.net.URL
import java.nio.file.Path
import kotlin.io.path.div
plugins {
id("com.jetbrains.python.envs") version "0.0.31"
}
val pythonsDirectory: Path = layout.buildDirectory.file("pythons").get().asFile.toPath()
val defaultArchiveWindows = "https://packages.jetbrains.team/files/p/py/python-archives-windows/"
val isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
val pythonExecutableName = if (isWindows) "python.exe" else "bin/python"
val defaultPackages = listOf("teamcity-messages")
envs {
bootstrapDirectory = pythonsDirectory.toFile()
zipRepository = URL(System.getenv().getOrDefault("PYCHARM_ZIP_REPOSITORY", defaultArchiveWindows))
shouldUseZipsFromRepository = isWindows
fun testHelpers(pythonName: String, pythonVersion: String) {
python(pythonName, pythonVersion, defaultPackages)
val pythonExecutable = pythonsDirectory / pythonName / pythonExecutableName
tasks.register<Exec>("Tests for Python ${pythonVersion}") {
mustRunAfter("build_envs")
environment("PYTHONPATH" to ".:..")
commandLine(pythonExecutable, "__main__.py")
}
}
testHelpers("py27_64", "2.7.18")
testHelpers("py38_64", if (isWindows) "3.8.10" else "3.8.19")
testHelpers("py39_64", if (isWindows) "3.9.13" else "3.9.19")
testHelpers("py310_64", if (isWindows) "3.10.11" else "3.10.14")
testHelpers("py311_64", "3.11.9")
testHelpers("py312_64", "3.12.4")
testHelpers("py313_64", "3.13.0b4")
}
tasks.register("all_tests") {
dependsOn("build_envs", tasks.matching { it.name.startsWith("Tests for Python") })
}