void (@NotNull final PyTestConfiguration configuration, @NotNull final PsiElement elementToRightClickOn) { PyFunction bar = getFunction("bar"); final PyTestConfiguration sameConfig = createConfigurationByElement(bar, PyTestConfiguration.class); assertEquals("Same element must provide same config", sameConfig, configuration); PyFunction foo = getFunction("foo"); final PyTestConfiguration differentConfig = createConfigurationByElement(foo, PyTestConfiguration.class); //Although targets are same, working dirs are different assert differentConfig.getTarget().equals(configuration.getTarget()); assertNotEquals("Function from different folder must provide different config", differentConfig, configuration); try { // Test "custom symbol" mode: instead of QN we must get custom with additional arguments pointing to file and symbol ((PyTestConfiguration)RunManager.getInstance(getProject()) .getConfigurationTemplate(new PyTestFactory(PythonTestConfigurationType.getInstance())).getConfiguration()).setWorkingDirectory( bar.getContainingFile().getParent().getVirtualFile().getPath()); PyTestConfiguration customConfiguration = createConfigurationByElement(foo, PyTestConfiguration.class); assertEquals(PyRunTargetVariant.CUSTOM, customConfiguration.getTarget().getTargetType()); assertEquals(foo.getContainingFile().getVirtualFile().getPath() + "::test_test", customConfiguration.getAdditionalArguments()); } finally { ((PyTestConfiguration)RunManager.getInstance(getProject()) .getConfigurationTemplate(new PyTestFactory(PythonTestConfigurationType.getInstance())).getConfiguration()).setWorkingDirectory( null); } }