From d1066811a779540fb64432036f93c8e29b0a4a5e Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 28 Jul 2021 17:19:47 +0300 Subject: [PATCH] PY-47941 Add a test on completion of pytest.mark The problem itself was fixed together with PY-48219 by switching to types to find possible attributes of a module/package. GitOrigin-RevId: 587b1c96610375836417655f0feb74f38edb4c69 --- .../AttributeReExportedWithAlias/_pytest/__init__.py | 0 .../AttributeReExportedWithAlias/_pytest/mark.py | 2 ++ .../AttributeReExportedWithAlias/main.py | 3 +++ .../AttributeReExportedWithAlias/pytest/__init__.py | 2 ++ .../python/PyNotImportedQualifiedNameCompletionTest.java | 5 +++++ 5 files changed, 12 insertions(+) create mode 100644 python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/_pytest/__init__.py create mode 100644 python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/_pytest/mark.py create mode 100644 python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/main.py create mode 100644 python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/pytest/__init__.py diff --git a/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/_pytest/__init__.py b/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/_pytest/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/_pytest/mark.py b/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/_pytest/mark.py new file mode 100644 index 000000000000..82a2abae8b95 --- /dev/null +++ b/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/_pytest/mark.py @@ -0,0 +1,2 @@ +MARK_GEN = ... +param = ... diff --git a/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/main.py b/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/main.py new file mode 100644 index 000000000000..8a113fe45d82 --- /dev/null +++ b/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/main.py @@ -0,0 +1,3 @@ +@pytest. +def test(): + pass diff --git a/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/pytest/__init__.py b/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/pytest/__init__.py new file mode 100644 index 000000000000..5f955e3055cc --- /dev/null +++ b/python/testData/completion/notImportedQualifiedName/AttributeReExportedWithAlias/pytest/__init__.py @@ -0,0 +1,2 @@ +from _pytest.mark import MARK_GEN as mark +from _pytest.mark import param \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyNotImportedQualifiedNameCompletionTest.java b/python/testSrc/com/jetbrains/python/PyNotImportedQualifiedNameCompletionTest.java index fa7974a4be4e..95c341c1f299 100644 --- a/python/testSrc/com/jetbrains/python/PyNotImportedQualifiedNameCompletionTest.java +++ b/python/testSrc/com/jetbrains/python/PyNotImportedQualifiedNameCompletionTest.java @@ -161,6 +161,11 @@ public class PyNotImportedQualifiedNameCompletionTest extends PyTestCase { assertContainsElements(doBasicCompletion(), "nspkg.submod", "nspkg.subpkg"); } + // PY-47941 + public void testAttributeReExportedWithAlias() { + assertContainsElements(doBasicCompletion(), "pytest.mark", "pytest.param"); + } + @Nullable private List doBasicCompletion() { myFixture.copyDirectoryToProject(getTestName(false), "");