mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
Fix Unit tests (PY-64546)
Verifies if there are python distributives for MacOS / Windows on ARM / X86 / X86_64 (cherry picked from commit 717f1a4540d12502e46e3b0fd29b08d2d2043281) IJ-MR-121650 GitOrigin-RevId: 71ff849618c362bec369372f4952824a454d607d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3e1de3259e
commit
09c8981fab
@@ -1,15 +1,16 @@
|
||||
package com.jetbrains.python.tests
|
||||
|
||||
import com.intellij.util.system.CpuArch
|
||||
import com.intellij.util.system.OS
|
||||
import com.jetbrains.python.psi.LanguageLevel
|
||||
import com.jetbrains.python.sdk.SdksKeeper
|
||||
import com.jetbrains.python.sdk.Product
|
||||
import junit.framework.TestCase.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class SdksTest {
|
||||
@Test
|
||||
fun testLoading() {
|
||||
assert(SdksKeeper.pythonReleasesByLanguageLevel().size == 5)
|
||||
assert(SdksKeeper.pythonReleasesByLanguageLevel().isNotEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -19,10 +20,24 @@ class SdksTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAvailableSorted() {
|
||||
assertEquals(
|
||||
setOf("3.8", "3.9", "3.10", "3.11", "3.12"),
|
||||
SdksKeeper.pythonReleasesByLanguageLevel().keys.map { it.toString() }.toSet()
|
||||
)
|
||||
fun testCPythonAvailableFor311and312() {
|
||||
val releases = SdksKeeper.pythonReleasesByLanguageLevel()
|
||||
|
||||
fun filter(os: OS, cpuArch: CpuArch): Set<LanguageLevel> {
|
||||
return releases.filterValues { releases ->
|
||||
releases.any { r ->
|
||||
r.product == Product.CPython &&
|
||||
r.binaries?.any { b -> b.os == os && b.cpuArch?.equals(cpuArch) != false } ?: false
|
||||
}
|
||||
}.keys
|
||||
}
|
||||
|
||||
val mandatory = listOf(LanguageLevel.PYTHON311, LanguageLevel.PYTHON312)
|
||||
for (os in listOf(OS.macOS, OS.Windows)) {
|
||||
for (cpuArch in listOf(CpuArch.X86, CpuArch.X86_64, CpuArch.ARM64)) {
|
||||
val missed = mandatory - filter(os, cpuArch)
|
||||
assert(missed.isEmpty()) { "Have no ${os} [${cpuArch}] distributive for version: ${missed}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user