void () { runPythonTest(new PyExecutionFixtureTestTask("testRunner/env/pytest/config/") { @Override public void runTestOn(@NotNull String sdkHome, @Nullable Sdk existingSdk) throws Exception { final PyTestConfiguration configuration = configureByFile("MyConfig.xml"); assertEquals("Wrong target type", new ConfigurationTarget("foo.py", PyRunTargetVariant.PATH), configuration.getTarget()); assertEquals("Wrong keywords", "keywords", configuration.getKeywords()); assertEquals("Wrong arguments", "--additional-args", configuration.getAdditionalArguments()); final PyTestConfiguration configurationWithCustom = configureByFile("MyConfigWithCustom.xml"); assertEquals("Wrong target type", new ConfigurationTarget("spam", PyRunTargetVariant.CUSTOM), configurationWithCustom.getTarget()); assertEquals("Wrong keywords", "keywords", configurationWithCustom.getKeywords()); assertEquals("Wrong arguments", "--additional-args", configurationWithCustom.getAdditionalArguments()); } @NotNull private PyTestConfiguration configureByFile(@NotNull final String path) throws IOException, JDOMException { final VirtualFile file = myFixture.getTempDirFixture().getFile(path); assert file != null : "No config found"; final SAXBuilder builder = new SAXBuilder(); final CharBuffer data = Charset.defaultCharset().decode(ByteBuffer.wrap(file.contentsToByteArray())); final Element element = builder.build(new StringReader(data.toString())).getRootElement(); final PyTestConfiguration configuration = new PyTestConfiguration(myFixture.getProject(), new PyTestFactory(PythonTestConfigurationType.getInstance())); configuration.readExternal(element); return configuration; } }); }