blob: b7e0e199eb702dd7fd147f4efe5f747d6e2745da [file]
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id "groovy"
id "com.jetbrains.python.envs" version "0.0.30"
}
File pythonDirectory = new File(buildDir, 'pythons')
boolean isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
String pythonExecutable = isWindows ? "python.exe" : "bin/python"
envs {
bootstrapDirectory = pythonDirectory
if (System.getenv().containsKey("PYCHARM_ZIP_REPOSITORY")) {
zipRepository = new URL(System.getenv().get("PYCHARM_ZIP_REPOSITORY"))
shouldUseZipsFromRepository = isWindows
}
Closure testHelpers = { String pythonName, String pythonVersion ->
python pythonName, pythonVersion, ["teamcity-messages"]
String python = pythonDirectory.absolutePath + File.separator + pythonName + File.separator + pythonExecutable
task ("Tests for Python " + pythonVersion, type: Exec){
mustRunAfter 'build_envs'
environment PYTHONPATH: ".:.."
commandLine python, '__main__.py'
}
}
testHelpers("py27_64", "2.7.16")
testHelpers("py36_64", "3.6.8")
testHelpers("py37_64", "3.7.6")
testHelpers("py38_64", "3.8.1")
}
task ("all_tests") {
dependsOn 'build_envs', tasks.findAll { it.name.startsWith("Tests for Python") }
}