void () { final String[] messages = { "Hello\n", ServiceMessageBuilder.testStarted("myTest").toString(), ServiceMessageBuilder.testStdOut("myTest").addAttribute("out", "I am\n").toString(), ServiceMessageBuilder.testFinished("myTest").toString(), "PyCharm" }; runPythonTest(new PyExecutionFixtureTestTask(null) { @Override public void runTestOn(@NotNull final String sdkHome, @Nullable Sdk existingSdk) throws Exception { final Project project = myFixture.getProject(); final Sdk sdk = createTempSdk(sdkHome, SdkCreationType.EMPTY_SDK); EdtTestUtil.runInEdtAndWait(() -> { final PythonConsoleView console = new PythonConsoleView(project, "test", sdk, true); console.getComponent(); //To init editor Arrays.stream(messages).forEach((s) -> console.print(s, ConsoleViewContentType.NORMAL_OUTPUT)); console.flushDeferredText(); try { assertEquals("TC messages filtered in wrong way", "Hello\nI am\nPyCharm", console.getText()); } finally { Disposer.dispose(console); } }); } }); }