mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python] add pyproject.toml unsatisfied requirement inspection test (PY-72985)
GitOrigin-RevId: f301151302e212bffa06b678c469417a2555d38c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
133bb61a1d
commit
e5fdee826d
+7
@@ -0,0 +1,7 @@
|
||||
[project]
|
||||
dependencies = [
|
||||
"<warning descr="Package mypy is not installed">mypy</warning>"
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["<warning descr="Package poetry-core is not installed">poetry-core</warning>"]
|
||||
+15
-1
@@ -2,14 +2,28 @@
|
||||
package com.jetbrains.python.requirements
|
||||
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl
|
||||
import com.intellij.lang.annotation.HighlightSeverity
|
||||
import com.intellij.testFramework.TestDataPath
|
||||
import com.jetbrains.python.sdk.pythonSdk
|
||||
|
||||
@TestDataPath("\$CONTENT_ROOT/../testData/requirements/inspections")
|
||||
class UnsatisfiedRequirementInspectionTest : PythonDependencyTestCase() {
|
||||
fun testUnsatisfiedRequirement() {
|
||||
doMultiFileTest("requirements.txt")
|
||||
assertContainsElements(myFixture.availableIntentions.map { it.text }, "Install package mypy", "Install all missing packages", "Run 'pip install -e .'")
|
||||
}
|
||||
|
||||
fun testPyProjectTomlUnsatisfiedRequirement() {
|
||||
doMultiFileTest("pyproject.toml")
|
||||
val warnings = myFixture.doHighlighting(HighlightSeverity.WARNING)
|
||||
|
||||
listOf("mypy", "poetry-core").forEach { unsatisfiedPackage ->
|
||||
val warning = warnings.single { it.text == unsatisfiedPackage }
|
||||
assertEquals("Package $unsatisfiedPackage is not installed", warning.description)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun testEmptyRequirementsFile() {
|
||||
doMultiFileTest("requirements.txt")
|
||||
assertContainsElements(myFixture.availableIntentions.map { it.text }, "Add imported packages to requirements…")
|
||||
@@ -19,7 +33,7 @@ class UnsatisfiedRequirementInspectionTest : PythonDependencyTestCase() {
|
||||
myFixture.copyDirectoryToProject(getTestName(false), "")
|
||||
myFixture.configureFromTempProjectFile(filename)
|
||||
myFixture.enableInspections(UnsatisfiedRequirementInspection::class.java)
|
||||
myFixture.checkHighlighting(true, false, true)
|
||||
myFixture.checkHighlighting(true, false, true, false)
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
|
||||
Reference in New Issue
Block a user