void () { runPythonTest(new PyUnitTestProcessWithConsoleTestTask("testRunner/env/unit/sysPath", "test.py") { @NotNull @Override protected PyUnitTestProcessRunner createProcessRunner() throws Exception { return new PyUnitTestProcessRunner("", 0) { @Override protected void configurationCreatedAndWillLaunch(@NotNull final PyUnitTestConfiguration configuration) throws IOException { super.configurationCreatedAndWillLaunch(configuration); configuration.getTarget().setTargetType(PyRunTargetVariant.PYTHON); configuration.getTarget().setTarget("test.DemoTest"); final VirtualFile subfolder = myFixture.getTempDirFixture().getFile("subfolder"); assert subfolder != null; configuration.setWorkingDirectory(subfolder.getPath()); } }; } @Override protected void checkTestResults(@NotNull final PyUnitTestProcessRunner runner, @NotNull final String stdout, @NotNull final String stderr, @NotNull final String all, int exitCode) { Assert.assertEquals("test failed: " + runner.getAllConsoleText(), 1, runner.getPassedTestsCount()); } }); }