diff --git a/python/src/com/jetbrains/python/codeInsight/testIntegration/CreateTestAction.java b/python/src/com/jetbrains/python/codeInsight/testIntegration/CreateTestAction.java index d47a36060560..217f60f5a959 100644 --- a/python/src/com/jetbrains/python/codeInsight/testIntegration/CreateTestAction.java +++ b/python/src/com/jetbrains/python/codeInsight/testIntegration/CreateTestAction.java @@ -49,7 +49,7 @@ public class CreateTestAction extends PsiElementBaseIntentionAction { public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { PyClass psiClass = PsiTreeUtil.getParentOfType(element, PyClass.class); - if (psiClass != null && PyTestUtil.isPyTestClass(psiClass)) + if (psiClass != null && PyTestUtil.isPyTestClass(psiClass, null)) return false; return true; } diff --git a/python/src/com/jetbrains/python/codeInsight/testIntegration/PyTestFinder.java b/python/src/com/jetbrains/python/codeInsight/testIntegration/PyTestFinder.java index 4dd34327ca13..44cd5f2cec9d 100644 --- a/python/src/com/jetbrains/python/codeInsight/testIntegration/PyTestFinder.java +++ b/python/src/com/jetbrains/python/codeInsight/testIntegration/PyTestFinder.java @@ -60,7 +60,7 @@ public class PyTestFinder implements TestFinder { for (String eachName : names) { if (eachName.contains(sourceName)) { for (PyClass eachClass : PyClassNameIndex.find(eachName, element.getProject(), GlobalSearchScope.projectScope(element.getProject()))) { - if (PythonUnitTestUtil.isTestCaseClass(eachClass) || PythonDocTestUtil.isDocTestClass(eachClass)) { + if (PythonUnitTestUtil.isTestCaseClass(eachClass, null) || PythonDocTestUtil.isDocTestClass(eachClass)) { classesWithProximities.add( new Pair(eachClass, TestFinderHelper.calcTestNameProximity(sourceName, eachName))); } @@ -102,7 +102,7 @@ public class PyTestFinder implements TestFinder { for (Pair eachNameWithWeight : possibleNames) { for (PyClass eachClass : PyClassNameIndex.find(eachNameWithWeight.first, element.getProject(), GlobalSearchScope.projectScope(element.getProject()))) { - if (!PyTestUtil.isPyTestClass(eachClass)) + if (!PyTestUtil.isPyTestClass(eachClass, null)) classesWithWeights.add(new Pair(eachClass, eachNameWithWeight.second)); } for (PyFunction function : PyFunctionNameIndex.find(eachNameWithWeight.first, element.getProject(), @@ -119,7 +119,7 @@ public class PyTestFinder implements TestFinder { public boolean isTest(@NotNull PsiElement element) { PyClass cl = PsiTreeUtil.getParentOfType(element, PyClass.class, false); if (cl != null) - return PyTestUtil.isPyTestClass(cl); + return PyTestUtil.isPyTestClass(cl, null); return false; } } diff --git a/python/src/com/jetbrains/python/inspections/PyProtectedMemberInspection.java b/python/src/com/jetbrains/python/inspections/PyProtectedMemberInspection.java index 8d13596eb622..9b22b33d8b48 100644 --- a/python/src/com/jetbrains/python/inspections/PyProtectedMemberInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyProtectedMemberInspection.java @@ -139,7 +139,7 @@ public class PyProtectedMemberInspection extends PyInspection { final PyClass parentClass = getClassOwner(node); if (parentClass != null) { - if (PyTestUtil.isPyTestClass(parentClass) && ignoreTestFunctions) return; + if (PyTestUtil.isPyTestClass(parentClass, null) && ignoreTestFunctions) return; if (parentClass.isSubclass(resolvedClass, null)) return; diff --git a/python/src/com/jetbrains/python/refactoring/introduce/field/PyIntroduceFieldHandler.java b/python/src/com/jetbrains/python/refactoring/introduce/field/PyIntroduceFieldHandler.java index 94474e59a59c..2ea4d7a33f13 100644 --- a/python/src/com/jetbrains/python/refactoring/introduce/field/PyIntroduceFieldHandler.java +++ b/python/src/com/jetbrains/python/refactoring/introduce/field/PyIntroduceFieldHandler.java @@ -88,7 +88,7 @@ public class PyIntroduceFieldHandler extends IntroduceHandler { } if (element1 != null) { final PyClass clazz = PyUtil.getContainingClassOrSelf(element1); - if (clazz != null && PythonUnitTestUtil.isTestCaseClass(clazz)) return true; + if (clazz != null && PythonUnitTestUtil.isTestCaseClass(clazz, null)) return true; } return false; } diff --git a/python/src/com/jetbrains/python/testing/PythonTestConfigurationProducer.java b/python/src/com/jetbrains/python/testing/PythonTestConfigurationProducer.java index 18b0899f834a..9ee9b3caa70e 100644 --- a/python/src/com/jetbrains/python/testing/PythonTestConfigurationProducer.java +++ b/python/src/com/jetbrains/python/testing/PythonTestConfigurationProducer.java @@ -133,7 +133,7 @@ abstract public class PythonTestConfigurationProducer extends RunConfigurationPr return setupConfigurationFromFunction(pyFunction, configuration); } final PyClass pyClass = PsiTreeUtil.getParentOfType(element, PyClass.class, false); - if (pyClass != null && isTestClass(pyClass, configuration)) { + if (pyClass != null && isTestClass(pyClass, configuration, TypeEvalContext.userInitiated(pyClass.getProject(), element.getContainingFile()))) { return setupConfigurationFromClass(pyClass, configuration); } if (element == null) return false; @@ -226,8 +226,8 @@ abstract public class PythonTestConfigurationProducer extends RunConfigurationPr } protected boolean isTestClass(@NotNull final PyClass pyClass, - @Nullable final AbstractPythonTestRunConfiguration configuration) { - return PythonUnitTestUtil.isTestCaseClass(pyClass); + @Nullable final AbstractPythonTestRunConfiguration configuration, @Nullable final TypeEvalContext context) { + return PythonUnitTestUtil.isTestCaseClass(pyClass, context); } protected boolean isTestFunction(@NotNull final PyFunction pyFunction, diff --git a/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java b/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java index 55cfd21c2af0..6e70c3ae8343 100644 --- a/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java +++ b/python/src/com/jetbrains/python/testing/PythonUnitTestUtil.java @@ -122,7 +122,7 @@ public class PythonUnitTestUtil { return false; } if (function.getContainingClass() != null) { - if (isTestCaseClass(function.getContainingClass())) return true; + if (isTestCaseClass(function.getContainingClass(), null)) return true; } if (checkAssert) { boolean hasAssert = hasAssertOrYield(function.getStatementList()); @@ -148,8 +148,8 @@ public class PythonUnitTestUtil { return false; } - public static boolean isTestCaseClass(@NotNull PyClass cls) { - return isTestCaseClassWithContext(cls, PYTHON_TEST_QUALIFIED_CLASSES, null); + public static boolean isTestCaseClass(@NotNull PyClass cls, @Nullable final TypeEvalContext context) { + return isTestCaseClassWithContext(cls, PYTHON_TEST_QUALIFIED_CLASSES, context); } public static boolean isTestCaseClassWithContext(@NotNull PyClass cls, diff --git a/python/src/com/jetbrains/python/testing/attest/PythonAtTestConfigurationProducer.java b/python/src/com/jetbrains/python/testing/attest/PythonAtTestConfigurationProducer.java index ecf72053f29f..a278d8e1fd5e 100644 --- a/python/src/com/jetbrains/python/testing/attest/PythonAtTestConfigurationProducer.java +++ b/python/src/com/jetbrains/python/testing/attest/PythonAtTestConfigurationProducer.java @@ -50,7 +50,9 @@ public class PythonAtTestConfigurationProducer extends } @Override - protected boolean isTestClass(@NotNull final PyClass pyClass, @Nullable final AbstractPythonTestRunConfiguration configuration) { + protected boolean isTestClass(@NotNull final PyClass pyClass, + @Nullable final AbstractPythonTestRunConfiguration configuration, + @Nullable final TypeEvalContext context) { for (PyClassLikeType type : pyClass.getAncestorTypes(TypeEvalContext.codeInsightFallback(pyClass.getProject()))) { if (type != null && "TestBase".equals(type.getName()) && hasTestFunction(pyClass)) { return true; @@ -86,7 +88,7 @@ public class PythonAtTestConfigurationProducer extends protected List getTestCaseClassesFromFile(@NotNull final PyFile file) { List result = Lists.newArrayList(); for (PyClass cls : file.getTopLevelClasses()) { - if (isTestClass(cls, null)) { + if (isTestClass(cls, null, null)) { result.add(cls); } } diff --git a/python/src/com/jetbrains/python/testing/doctest/PythonDocTestConfigurationProducer.java b/python/src/com/jetbrains/python/testing/doctest/PythonDocTestConfigurationProducer.java index f1ba6903ddeb..b40c3168c25c 100644 --- a/python/src/com/jetbrains/python/testing/doctest/PythonDocTestConfigurationProducer.java +++ b/python/src/com/jetbrains/python/testing/doctest/PythonDocTestConfigurationProducer.java @@ -30,6 +30,7 @@ import com.jetbrains.python.psi.PyClass; import com.jetbrains.python.psi.PyElement; import com.jetbrains.python.psi.PyFile; import com.jetbrains.python.psi.PyFunction; +import com.jetbrains.python.psi.types.TypeEvalContext; import com.jetbrains.python.testing.AbstractPythonTestRunConfiguration; import com.jetbrains.python.testing.PythonTestConfigurationProducer; import com.jetbrains.python.testing.PythonTestConfigurationType; @@ -50,7 +51,9 @@ public class PythonDocTestConfigurationProducer extends PythonTestConfigurationP } @Override - protected boolean isTestClass(@NotNull PyClass pyClass, @Nullable final AbstractPythonTestRunConfiguration configuration) { + protected boolean isTestClass(@NotNull PyClass pyClass, + @Nullable final AbstractPythonTestRunConfiguration configuration, + @Nullable final TypeEvalContext context) { return PythonDocTestUtil.isDocTestClass(pyClass); } diff --git a/python/src/com/jetbrains/python/testing/pytest/PyTestConfigurationProducer.java b/python/src/com/jetbrains/python/testing/pytest/PyTestConfigurationProducer.java index b75dec888422..2249516da492 100644 --- a/python/src/com/jetbrains/python/testing/pytest/PyTestConfigurationProducer.java +++ b/python/src/com/jetbrains/python/testing/pytest/PyTestConfigurationProducer.java @@ -35,6 +35,7 @@ import com.jetbrains.python.psi.PyClass; import com.jetbrains.python.psi.PyFile; import com.jetbrains.python.psi.PyFunction; import com.jetbrains.python.psi.PyStatement; +import com.jetbrains.python.psi.types.TypeEvalContext; import com.jetbrains.python.sdk.PythonSdkType; import com.jetbrains.python.testing.*; import org.jetbrains.annotations.NotNull; @@ -55,23 +56,40 @@ public class PyTestConfigurationProducer extends PythonTestConfigurationProducer Ref sourceElement) { final PsiElement element = sourceElement.get(); final Module module = ModuleUtilCore.findModuleForPsiElement(element); - if (!(configuration instanceof PyTestRunConfiguration)) return false; - if (module == null) return false; + if (!(configuration instanceof PyTestRunConfiguration)) { + return false; + } + if (module == null) { + return false; + } if (!(TestRunnerService.getInstance(module).getProjectConfiguration().equals( - PythonTestConfigurationsModel.PY_TEST_NAME))) return false; + PythonTestConfigurationsModel.PY_TEST_NAME))) { + return false; + } final PsiFileSystemItem file = element instanceof PsiDirectory ? (PsiDirectory)element : element.getContainingFile(); - if (file == null) return false; + if (file == null) { + return false; + } final VirtualFile virtualFile = file.getVirtualFile(); - if (virtualFile == null) return false; + if (virtualFile == null) { + return false; + } if (file instanceof PyFile || file instanceof PsiDirectory) { - final List testCases = PyTestUtil.getPyTestCasesFromFile(file); - if (testCases.isEmpty()) return false; - } else return false; + final List testCases = PyTestUtil.getPyTestCasesFromFile(file, TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile())); + if (testCases.isEmpty()) { + return false; + } + } + else { + return false; + } final Sdk sdk = PythonSdkType.findPythonSdk(context.getModule()); - if (sdk == null) return false; + if (sdk == null) { + return false; + } configuration.setUseModuleSdk(true); configuration.setModule(ModuleUtilCore.findModuleForPsiElement(element)); @@ -83,8 +101,9 @@ public class PyTestConfigurationProducer extends PythonTestConfigurationProducer ((PyTestRunConfiguration)configuration).setKeywords(keywords); configuration.setName("py.test in " + keywords); } - else + else { configuration.setName("py.test in " + file.getName()); + } return true; } @@ -142,9 +161,12 @@ public class PyTestConfigurationProducer extends PythonTestConfigurationProducer if (virtualFile == null) return false; if (file instanceof PyFile || file instanceof PsiDirectory) { - final List testCases = PyTestUtil.getPyTestCasesFromFile(file); + final List testCases = PyTestUtil.getPyTestCasesFromFile(file, TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile())); if (testCases.isEmpty()) return false; - } else return false; + } + else { + return false; + } final Sdk sdk = PythonSdkType.findPythonSdk(context.getModule()); if (sdk == null) return false; diff --git a/python/src/com/jetbrains/python/testing/pytest/PyTestUtil.java b/python/src/com/jetbrains/python/testing/pytest/PyTestUtil.java index a888e1292da9..c62a4d5d4ce3 100644 --- a/python/src/com/jetbrains/python/testing/pytest/PyTestUtil.java +++ b/python/src/com/jetbrains/python/testing/pytest/PyTestUtil.java @@ -26,6 +26,8 @@ import com.jetbrains.python.psi.PyFunction; import com.jetbrains.python.psi.PyStatement; import com.jetbrains.python.psi.types.PyClassLikeType; import com.jetbrains.python.psi.types.TypeEvalContext; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Set; @@ -36,24 +38,25 @@ import java.util.Set; public class PyTestUtil { private static final Set PYTHON_TEST_QUALIFIED_CLASSES = ImmutableSet.of("unittest.TestCase", "unittest.case.TestCase"); - public static List getPyTestCasesFromFile(PsiFileSystemItem file) { + static List getPyTestCasesFromFile(PsiFileSystemItem file, @NotNull final TypeEvalContext context) { List result = Lists.newArrayList(); if (file instanceof PyFile) { - result = getResult((PyFile)file); + result = getResult((PyFile)file, context); } else if (file instanceof PsiDirectory) { for (PsiFile f : ((PsiDirectory)file).getFiles()) { - if (f instanceof PyFile) - result.addAll(getResult((PyFile)f)); + if (f instanceof PyFile) { + result.addAll(getResult((PyFile)f, context)); + } } } return result; } - private static List getResult(PyFile file) { + private static List getResult(PyFile file, @NotNull final TypeEvalContext context) { List result = Lists.newArrayList(); for (PyClass cls : file.getTopLevelClasses()) { - if (isPyTestClass(cls)) { + if (isPyTestClass(cls, context)) { result.add(cls); } } @@ -73,8 +76,9 @@ public class PyTestUtil { return false; } - public static boolean isPyTestClass(PyClass pyClass) { - for (PyClassLikeType type : pyClass.getAncestorTypes(TypeEvalContext.codeInsightFallback(pyClass.getProject()))) { + public static boolean isPyTestClass(final PyClass pyClass, @Nullable final TypeEvalContext context) { + final TypeEvalContext contextToUse = (context != null ? context : TypeEvalContext.codeInsightFallback(pyClass.getProject())); + for (PyClassLikeType type : pyClass.getAncestorTypes(contextToUse)) { if (type != null && PYTHON_TEST_QUALIFIED_CLASSES.contains(type.getClassQName())) { return true; } diff --git a/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestConfigurationProducer.java b/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestConfigurationProducer.java index b581438d508b..368933c1a4f3 100644 --- a/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestConfigurationProducer.java +++ b/python/src/com/jetbrains/python/testing/unittest/PythonUnitTestConfigurationProducer.java @@ -29,6 +29,7 @@ import com.jetbrains.python.psi.PyClass; import com.jetbrains.python.psi.PyFile; import com.jetbrains.python.psi.PyFunction; import com.jetbrains.python.psi.PyStatement; +import com.jetbrains.python.psi.types.TypeEvalContext; import com.jetbrains.python.testing.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -60,8 +61,10 @@ public class PythonUnitTestConfigurationProducer extends PythonTestConfiguration } @Override - protected boolean isTestClass(@NotNull PyClass pyClass, @Nullable final AbstractPythonTestRunConfiguration configuration) { - final boolean isTestClass = super.isTestClass(pyClass, configuration); + protected boolean isTestClass(@NotNull PyClass pyClass, + @Nullable final AbstractPythonTestRunConfiguration configuration, + TypeEvalContext context) { + final boolean isTestClass = super.isTestClass(pyClass, configuration, context); return isTestClass || (configuration instanceof PythonUnitTestRunConfiguration && !((PythonUnitTestRunConfiguration)configuration).isPureUnittest()); } diff --git a/python/testData/testRunner/env/createConfigurationTest/aid/__init__.py b/python/testData/testRunner/env/createConfigurationTest/aid/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/testData/testRunner/env/createConfigurationTest/aid/test/__init__.py b/python/testData/testRunner/env/createConfigurationTest/aid/test/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/testData/testRunner/env/createConfigurationTest/aid/test/base.py b/python/testData/testRunner/env/createConfigurationTest/aid/test/base.py new file mode 100644 index 000000000000..37ef59e2c487 --- /dev/null +++ b/python/testData/testRunner/env/createConfigurationTest/aid/test/base.py @@ -0,0 +1,6 @@ +import unittest + + +class TestBase(unittest.TestCase): + + pass \ No newline at end of file diff --git a/python/testData/testRunner/env/createConfigurationTest/test.py b/python/testData/testRunner/env/createConfigurationTest/test.py new file mode 100644 index 000000000000..6a367ce797e3 --- /dev/null +++ b/python/testData/testRunner/env/createConfigurationTest/test.py @@ -0,0 +1,12 @@ +# This does not work + +import aid.test.base + + +class TheTest(aid.test.base.TestBase): + + def test_case_1(self): + self.fail() + + def test_case_2(self): + pass \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/env/python/testing/CreateConfigurationTestTask.java b/python/testSrc/com/jetbrains/env/python/testing/CreateConfigurationTestTask.java new file mode 100644 index 000000000000..0e47f6b5d9a0 --- /dev/null +++ b/python/testSrc/com/jetbrains/env/python/testing/CreateConfigurationTestTask.java @@ -0,0 +1,97 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jetbrains.env.python.testing; + +import com.intellij.execution.actions.ConfigurationContext; +import com.intellij.execution.actions.ConfigurationFromContext; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; +import com.intellij.psi.PsiElement; +import com.jetbrains.env.PyExecutionFixtureTestTask; +import com.jetbrains.python.sdk.InvalidSdkException; +import com.jetbrains.python.sdkTools.SdkCreationType; +import com.jetbrains.python.testing.PythonTestConfigurationProducer; +import com.jetbrains.python.testing.TestRunnerService; +import org.jetbrains.annotations.NotNull; +import org.junit.Assert; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + + +/** + * Task to be run by env test to check tests can create configurations. + * It sets cursor to unit-style testcase, and creates configuration from it. + * + * @author Ilya.Kazakevich + */ +class CreateConfigurationTestTask extends PyExecutionFixtureTestTask { + + @NotNull + private final String myTestRunnerName; + @NotNull + private final Class myProducer; + + /** + * @param producer class of configuration producer to check + * @param testRunnerName test runner name (to set as default to make sure producer launched) + */ + CreateConfigurationTestTask(@NotNull final Class producer, + @NotNull final String testRunnerName) { + myProducer = producer; + myTestRunnerName = testRunnerName; + } + + @Override + protected String getTestDataPath() { + return super.getTestDataPath() + "/testRunner/env/createConfigurationTest/"; + } + + @Override + public void runTestOn(final String sdkHome) throws InvalidSdkException, IOException { + // Set as default runner to check + TestRunnerService.getInstance(myFixture.getModule()).setProjectConfiguration(myTestRunnerName); + + createTempSdk(sdkHome, SdkCreationType.SDK_PACKAGES_ONLY); + ApplicationManager.getApplication().invokeAndWait(() -> ApplicationManager.getApplication().runWriteAction(() -> { + myFixture.configureByFile("test.py"); + // Should create configuration from test class + checkConfigurationCreatedFrom(myFixture.getElementAtCaret()); + // And from file + checkConfigurationCreatedFrom(myFixture.getElementAtCaret().getContainingFile()); + }), ModalityState.NON_MODAL); + } + + + private void checkConfigurationCreatedFrom(@NotNull final PsiElement element) { + + final PythonTestConfigurationProducer producer = createProducer(); + final ConfigurationFromContext context = + producer.createConfigurationFromContext(new ConfigurationContext(element)); + Assert.assertNotNull(String.format("Failed to create context for %s", myTestRunnerName), context); + Assert.assertNotNull(String.format("Configuration %s has not name", myTestRunnerName), context.getConfiguration().getName()); + } + + @NotNull + private PythonTestConfigurationProducer createProducer() { + try { + return myProducer.getConstructor().newInstance(); + } + catch (final InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + throw new AssertionError(String.format("Failed to create instance of %s", myProducer), e); + } + } +} diff --git a/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java b/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java index 6aef9db7b236..4bcc228906c4 100644 --- a/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java +++ b/python/testSrc/com/jetbrains/env/python/testing/PythonNoseTestingTest.java @@ -1,17 +1,25 @@ package com.jetbrains.env.python.testing; import com.jetbrains.env.EnvTestTagsRequired; -import com.jetbrains.env.PyProcessWithConsoleTestTask; import com.jetbrains.env.PyEnvTestCase; +import com.jetbrains.env.PyProcessWithConsoleTestTask; import com.jetbrains.env.ut.PyNoseTestProcessRunner; import com.jetbrains.python.sdkTools.SdkCreationType; +import com.jetbrains.python.testing.PythonTestConfigurationsModel; +import com.jetbrains.python.testing.nosetest.PythonNoseTestConfigurationProducer; import org.jetbrains.annotations.NotNull; /** * User : catherine */ @EnvTestTagsRequired(tags = "nose") -public class PythonNoseTestingTest extends PyEnvTestCase { +public final class PythonNoseTestingTest extends PyEnvTestCase { + + + public void testConfigurationProducer() throws Exception { + runPythonTest( + new CreateConfigurationTestTask(PythonNoseTestConfigurationProducer.class, PythonTestConfigurationsModel.PYTHONS_NOSETEST_NAME)); + } public void testNoseRunner() { diff --git a/python/testSrc/com/jetbrains/env/python/testing/PythonPyTestingTest.java b/python/testSrc/com/jetbrains/env/python/testing/PythonPyTestingTest.java index 52f8f394c011..330056c2bb69 100644 --- a/python/testSrc/com/jetbrains/env/python/testing/PythonPyTestingTest.java +++ b/python/testSrc/com/jetbrains/env/python/testing/PythonPyTestingTest.java @@ -7,6 +7,9 @@ import com.jetbrains.env.PyProcessWithConsoleTestTask; import com.jetbrains.env.PyEnvTestCase; import com.jetbrains.env.ut.PyTestTestProcessRunner; import com.jetbrains.python.sdkTools.SdkCreationType; +import com.jetbrains.python.testing.PythonTestConfigurationsModel; +import com.jetbrains.python.testing.nosetest.PythonNoseTestConfigurationProducer; +import com.jetbrains.python.testing.pytest.PyTestConfigurationProducer; import org.hamcrest.Matchers; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -18,6 +21,12 @@ import java.util.List; */ @EnvTestTagsRequired(tags = "pytest") public class PythonPyTestingTest extends PyEnvTestCase { + + public void testConfigurationProducer() throws Exception { + runPythonTest( + new CreateConfigurationTestTask(PyTestConfigurationProducer.class, PythonTestConfigurationsModel.PY_TEST_NAME)); + } + public void testPytestRunner() { runPythonTest(new PyProcessWithConsoleTestTask(SdkCreationType.EMPTY_SDK) { diff --git a/python/testSrc/com/jetbrains/env/python/testing/PythonUnitTestingTest.java b/python/testSrc/com/jetbrains/env/python/testing/PythonUnitTestingTest.java index 240de0e08c7d..c9ccb798709b 100644 --- a/python/testSrc/com/jetbrains/env/python/testing/PythonUnitTestingTest.java +++ b/python/testSrc/com/jetbrains/env/python/testing/PythonUnitTestingTest.java @@ -4,6 +4,8 @@ import com.intellij.openapi.util.text.StringUtil; import com.jetbrains.env.PyEnvTestCase; import com.jetbrains.env.ut.PyUnitTestProcessRunner; import com.jetbrains.python.psi.LanguageLevel; +import com.jetbrains.python.testing.PythonTestConfigurationsModel; +import com.jetbrains.python.testing.unittest.PythonUnitTestConfigurationProducer; import org.hamcrest.Matchers; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -14,6 +16,11 @@ import java.util.List; * @author traff */ public final class PythonUnitTestingTest extends PyEnvTestCase { + + public void testConfigurationProducer() throws Exception { + runPythonTest( + new CreateConfigurationTestTask(PythonUnitTestConfigurationProducer.class, PythonTestConfigurationsModel.PYTHONS_UNITTEST_NAME)); + } public void testUTRunner() { runPythonTest(new PyUnitTestProcessWithConsoleTestTask("/testRunner/env/unit", "test1.py") {