mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add OS-specific staging for Env tests
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
public enum TestEnv {
|
||||
WINDOWS, LINUX, MAC
|
||||
}
|
||||
+16
-2
@@ -5,12 +5,14 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.jetbrains.TestEnv;
|
||||
import com.jetbrains.python.packaging.PyPackage;
|
||||
import com.jetbrains.python.packaging.PyPackageManager;
|
||||
import org.hamcrest.Matchers;
|
||||
@@ -46,7 +48,7 @@ public abstract class PyEnvTestCase {
|
||||
public static final boolean RUN_REMOTE = SystemProperties.getBooleanProperty("pycharm.run_remote", false);
|
||||
|
||||
public static final boolean RUN_LOCAL = SystemProperties.getBooleanProperty("pycharm.run_local", true);
|
||||
|
||||
|
||||
private static final boolean STAGING_ENV = SystemProperties.getBooleanProperty("pycharm.staging_env", false);
|
||||
|
||||
/**
|
||||
@@ -73,7 +75,19 @@ public abstract class PyEnvTestCase {
|
||||
|
||||
protected boolean isStaging(Description description) {
|
||||
try {
|
||||
return description.getTestClass().getMethod(description.getMethodName()).isAnnotationPresent(Staging.class);
|
||||
if (description.getTestClass().getMethod(description.getMethodName()).isAnnotationPresent(Staging.class)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
for (StagingOn so : description.getTestClass().getMethod(description.getMethodName()).getAnnotationsByType(StagingOn.class)) {
|
||||
if (so.os() == TestEnv.WINDOWS && SystemInfo.isWindows ||
|
||||
so.os() == TestEnv.LINUX && SystemInfo.isLinux ||
|
||||
so.os() == TestEnv.MAC && SystemInfo.isMac) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
return false;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.execution.testframework.sm.runner.SMTestProxy;
|
||||
import com.intellij.execution.testframework.sm.runner.ui.MockPrinter;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.jetbrains.TestEnv;
|
||||
import com.jetbrains.python.PythonHelpersLocator;
|
||||
import com.jetbrains.python.sdkTools.SdkCreationType;
|
||||
import com.jetbrains.python.testing.tox.PyToxConfiguration;
|
||||
@@ -61,6 +62,7 @@ public final class PyToxTest extends PyEnvTestCase {
|
||||
* Check tox nose runner
|
||||
*/
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testToxNose() {
|
||||
runPythonTest(new MyPyProcessWithConsoleTestTask(1,
|
||||
new MyTestProcessRunner("/testData/toxtest/toxNose/"),
|
||||
@@ -79,6 +81,7 @@ public final class PyToxTest extends PyEnvTestCase {
|
||||
* Check tox pytest runner
|
||||
*/
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testToxPyTest() {
|
||||
runPythonTest(new MyPyProcessWithConsoleTestTask(1,
|
||||
new MyTestProcessRunner("/testData/toxtest/toxPyTest/"),
|
||||
@@ -97,6 +100,7 @@ public final class PyToxTest extends PyEnvTestCase {
|
||||
* Check tox unit runner
|
||||
*/
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testToxUnitTest() {
|
||||
runPythonTest(new MyPyProcessWithConsoleTestTask(1,
|
||||
new MyTestProcessRunner("/testData/toxtest/toxUnitTest/"),
|
||||
@@ -115,6 +119,7 @@ public final class PyToxTest extends PyEnvTestCase {
|
||||
* Big test which should run on any interpreter and check its output
|
||||
*/
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testToxSuccessTest() {
|
||||
runPythonTest(new MyPyProcessWithConsoleTestTask(1,
|
||||
new MyTestProcessRunner("/testData/toxtest/toxSuccess/"),
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.jetbrains.TestEnv;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface StagingOn {
|
||||
TestEnv os();
|
||||
}
|
||||
@@ -9,9 +9,11 @@ import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
|
||||
import com.intellij.xdebugger.XDebuggerTestUtil;
|
||||
import com.jetbrains.TestEnv;
|
||||
import com.jetbrains.env.PyEnvTestCase;
|
||||
import com.jetbrains.env.PyProcessWithConsoleTestTask;
|
||||
import com.jetbrains.env.Staging;
|
||||
import com.jetbrains.env.StagingOn;
|
||||
import com.jetbrains.env.python.debug.PyDebuggerTask;
|
||||
import com.jetbrains.env.ut.PyUnitTestProcessRunner;
|
||||
import com.jetbrains.python.PythonHelpersLocator;
|
||||
@@ -239,6 +241,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testStepInto() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test2.py") {
|
||||
@Override
|
||||
@@ -350,6 +353,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testRunToLine() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_runtoline.py") {
|
||||
@Override
|
||||
@@ -535,6 +539,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testEggDebug() throws Exception {
|
||||
runPythonTest(new PyDebuggerTask("/debug", "test_egg.py") {
|
||||
@Override
|
||||
@@ -607,6 +612,7 @@ public class PythonDebuggerTest extends PyEnvTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
@StagingOn(os = TestEnv.WINDOWS)
|
||||
public void testWinLongName() throws Exception {
|
||||
if (UsefulTestCase.IS_UNDER_TEAMCITY && !SystemInfo.isWindows) {
|
||||
return; // Only needs to run on windows
|
||||
|
||||
Reference in New Issue
Block a user