mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-79488 Add a test on removing the fake top-level module on model sync
GitOrigin-RevId: 910bad221ec0342c10dfe75908418174814f1392
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8cc9b6ed97
commit
4de911624f
@@ -124,6 +124,8 @@ abstract class BaseProjectModelService<E : EntitySource> {
|
||||
/**
|
||||
* Removes the default IJ module created for the root of the project
|
||||
* (that's going to be replaced with a module belonging to a specific project management system).
|
||||
*
|
||||
* @see com.intellij.platform.PlatformProjectConfigurator
|
||||
*/
|
||||
fun removeFakeModuleEntity(project: Project, storage: MutableEntityStorage) {
|
||||
val virtualFileUrlManager = project.workspaceModel.getVirtualFileUrlManager()
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.jetbrains.python.projectModel.uv
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.externalSystem.testFramework.fixtures.multiProjectFixture
|
||||
import com.intellij.platform.testFramework.assertion.collectionAssertion.CollectionAssertions
|
||||
import com.intellij.platform.testFramework.assertion.moduleAssertion.ContentRootAssertions
|
||||
import com.intellij.platform.testFramework.assertion.moduleAssertion.DependencyAssertions
|
||||
import com.intellij.platform.testFramework.assertion.moduleAssertion.ModuleAssertions
|
||||
import com.intellij.testFramework.common.timeoutRunBlocking
|
||||
@@ -74,6 +75,33 @@ class PyUvOpenIntegrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `manually syncing a not recognized project removes its fake top-level module`() = timeoutRunBlocking(timeout = 20.seconds) {
|
||||
val projectPath = testRoot.resolve("project")
|
||||
|
||||
projectPath.createFile("pyproject.toml").writeText("""
|
||||
[project]
|
||||
name = "myproject"
|
||||
""".trimIndent())
|
||||
|
||||
multiprojectFixture.openProject(projectPath).useProjectAsync { project ->
|
||||
// Nothing was linked automatically. There is only the module created by PlatformProjectConfigurator.
|
||||
ModuleAssertions.assertModules(project, "project")
|
||||
ContentRootAssertions.assertContentRoots(project, "project", listOf(projectPath))
|
||||
CollectionAssertions.assertEqualsUnordered(emptyList(), project.service<UvSettings>().getLinkedProjects())
|
||||
|
||||
multiprojectFixture.awaitProjectConfiguration(project) {
|
||||
UvProjectModelService.linkAllProjectModelRoots(project, project.basePath!!)
|
||||
UvProjectModelService.syncAllProjectModelRoots(project)
|
||||
}
|
||||
|
||||
// Now there is only the module owned by Uv
|
||||
ModuleAssertions.assertModules(project, "myproject")
|
||||
CollectionAssertions.assertEqualsUnordered(listOf(projectPath), project.service<UvSettings>().getLinkedProjects())
|
||||
ContentRootAssertions.assertContentRoots(project, "myproject", listOf(projectPath))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test monorepo without top-level pyproject-toml and with sibling path dependency`() = timeoutRunBlocking(timeout = 20.seconds) {
|
||||
val projectPath = testRoot.resolve("project")
|
||||
|
||||
Reference in New Issue
Block a user