mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-18839: Adding test
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
class BaseTestCases:
|
||||
class TestAbstract(TestCase):
|
||||
def test_a(self):
|
||||
raise Exception()
|
||||
|
||||
|
||||
class TestDerived(BaseTestCases.TestAbstract):
|
||||
def test_b(self):
|
||||
print("Running from derived class")
|
||||
+1
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.jetbrains.env.python.testing;
|
||||
|
||||
import com.jetbrains.env.PyEnvTestCase;
|
||||
import com.jetbrains.env.PyProcessWithConsoleTestTask;
|
||||
import com.jetbrains.env.ut.PyUnitTestProcessRunner;
|
||||
import com.jetbrains.python.sdkTools.SdkCreationType;
|
||||
@@ -29,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
abstract class PyUnitTestProcessWithConsoleTestTask extends PyProcessWithConsoleTestTask<PyUnitTestProcessRunner> {
|
||||
@NotNull
|
||||
private final String myScriptName;
|
||||
protected final String myScriptName;
|
||||
|
||||
PyUnitTestProcessWithConsoleTestTask(@NotNull final String relativePathToTestData, @NotNull final String scriptName) {
|
||||
super(relativePathToTestData, SdkCreationType.EMPTY_SDK);
|
||||
|
||||
@@ -89,6 +89,27 @@ public final class PythonUnitTestingTest extends PyEnvTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure rerun test works even if test is declared in parent
|
||||
*/
|
||||
@Test
|
||||
public void testRerunDerivedClass() throws Exception {
|
||||
runPythonTest(new PyUnitTestProcessWithConsoleTestTask("/testRunner/env/unit", "rerun_derived.py") {
|
||||
@Override
|
||||
protected void checkTestResults(@NotNull final PyUnitTestProcessRunner runner,
|
||||
@NotNull final String stdout,
|
||||
@NotNull final String stderr,
|
||||
@NotNull final String all) {
|
||||
Assert.assertThat("Premature error", stderr, isEmptyString());
|
||||
Assert.assertThat("Wrong number of failed tests", runner.getFailedTestsCount(), equalTo(1));
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
protected PyUnitTestProcessRunner createProcessRunner() throws Exception {
|
||||
return new PyUnitTestProcessRunner(myScriptName, 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Run tests, delete file and click "rerun" should throw exception and display error since test ids do not point to correct PSI
|
||||
|
||||
Reference in New Issue
Block a user