From cb899e1dad3e1313abeaf40a6f4d17dac1bada52 Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Mon, 27 Apr 2020 00:50:51 +0300 Subject: [PATCH] Warn user if legacy runner is used, remove outdated EP, mark redundant interface as deprecated GitOrigin-RevId: 9ead5bcf99fd87fb5bde6d6fa88426ddfefebab8 --- python/helpers/pycharm/noserunner.py | 6 +++- python/helpers/pycharm/pytestrunner.py | 6 ++-- python/helpers/pycharm/utrunner.py | 5 ++- .../PythonUnitTestRunnableScriptFilter.java | 9 ++--- .../testing/RunnableUnitTestFilter.java | 33 ------------------- 5 files changed, 18 insertions(+), 41 deletions(-) delete mode 100644 python/src/com/jetbrains/python/testing/RunnableUnitTestFilter.java diff --git a/python/helpers/pycharm/noserunner.py b/python/helpers/pycharm/noserunner.py index ff45dba4c6e5..bc50b8a419ee 100644 --- a/python/helpers/pycharm/noserunner.py +++ b/python/helpers/pycharm/noserunner.py @@ -1,5 +1,9 @@ import sys import os +import sys +sys.stderr.write("Warning: You are using test runners in legacy mode\n. " + "That means you have 'python.tests.enableUniversalTests=false' in registry.\n" + "This mode will be dropped in 2021. Consider removing this entry from registry and migrating to new test runners") helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0]) if sys.path[0] != helpers_dir: @@ -93,4 +97,4 @@ def process_args(): TestProgram(argv=argv, config=config, exit=False) if __name__ == "__main__": - process_args() \ No newline at end of file + process_args() diff --git a/python/helpers/pycharm/pytestrunner.py b/python/helpers/pycharm/pytestrunner.py index d54638e7cf79..c09d8ffb45dd 100644 --- a/python/helpers/pycharm/pytestrunner.py +++ b/python/helpers/pycharm/pytestrunner.py @@ -1,5 +1,7 @@ import sys - +sys.stderr.write("Warning: You are using test runners in legacy mode\n. " + "That means you have 'python.tests.enableUniversalTests=false' in registry.\n" + "This mode will be dropped in 2021. Consider removing this entry from registry and migrating to new test runners") has_pytest = False #there is the difference between 1.3.4 and 2.0.2 versions #Since version 1.4, the testing tool "py.test" is part of its own pytest distribution. @@ -57,4 +59,4 @@ else: return exitstatus if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/python/helpers/pycharm/utrunner.py b/python/helpers/pycharm/utrunner.py index f387e2c824d4..cb404d2130d7 100644 --- a/python/helpers/pycharm/utrunner.py +++ b/python/helpers/pycharm/utrunner.py @@ -2,7 +2,10 @@ import sys import imp import os import fnmatch - +import sys +sys.stderr.write("Warning: You are using test runners in legacy mode\n. " + "That means you have 'python.tests.enableUniversalTests=false' in registry.\n" + "This mode will be dropped in 2021. Consider removing this entry from registry and migrating to new test runners") roots = sys.path[:] helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0]) diff --git a/python/src/com/jetbrains/python/testing/PythonUnitTestRunnableScriptFilter.java b/python/src/com/jetbrains/python/testing/PythonUnitTestRunnableScriptFilter.java index dcefb8502065..3e1f410968bb 100644 --- a/python/src/com/jetbrains/python/testing/PythonUnitTestRunnableScriptFilter.java +++ b/python/src/com/jetbrains/python/testing/PythonUnitTestRunnableScriptFilter.java @@ -16,18 +16,19 @@ package com.jetbrains.python.testing; import com.intellij.execution.Location; -import com.intellij.openapi.module.Module; -import com.intellij.psi.PsiFile; import com.jetbrains.python.run.RunnableScriptFilter; +import org.jetbrains.annotations.ApiStatus; /** * @author Ilya.Kazakevich */ -public class PythonUnitTestRunnableScriptFilter { +public final class PythonUnitTestRunnableScriptFilter { + private PythonUnitTestRunnableScriptFilter(){} /** - * @deprecated Use {@link RunnableUnitTestFilter#isRunnableUnitTest(PsiFile, Module)} instead. Delete after 2017.2 + * @deprecated Use {@link RunnableScriptFilter#isIfNameMain(Location)} instead. */ + @ApiStatus.ScheduledForRemoval(inVersion = "2021.1") @Deprecated public static boolean isIfNameMain(Location location) { return RunnableScriptFilter.isIfNameMain(location); diff --git a/python/src/com/jetbrains/python/testing/RunnableUnitTestFilter.java b/python/src/com/jetbrains/python/testing/RunnableUnitTestFilter.java deleted file mode 100644 index 6ad5d5e6da23..000000000000 --- a/python/src/com/jetbrains/python/testing/RunnableUnitTestFilter.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2014 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.python.testing; - -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.module.Module; -import com.intellij.psi.PsiFile; -import org.jetbrains.annotations.NotNull; - -/** - * Filters out Python unit tests for which it doesn't make sense to run the standard unit test configuration, - * and which are (possibly) run by other configurations instead. - * - * @author yole - */ -public interface RunnableUnitTestFilter { - ExtensionPointName EP_NAME = ExtensionPointName.create("Pythonid.runnableUnitTestFilter"); - - boolean isRunnableUnitTest(PsiFile script, @NotNull Module module); -} \ No newline at end of file