void () { runPythonTest( new CreateConfigurationByFileTask<>(new PyUnitTestFactory(PythonTestConfigurationType.getInstance()).getName(), PyUnitTestConfiguration.class) { private static final String SOME_RANDOM_DIR = "//some/random/ddir"; @Override public void runTestOn(@NotNull final String sdkHome, @Nullable Sdk existingSdk) throws InvalidSdkException { // Set default working directory to some random location before actual exection final PyUnitTestConfiguration templateConfiguration = getTemplateConfiguration(new PyUnitTestFactory(PythonTestConfigurationType.getInstance())); templateConfiguration.setWorkingDirectory(SOME_RANDOM_DIR); super.runTestOn(sdkHome, existingSdk); templateConfiguration.setWorkingDirectory(""); } @Override protected void checkConfiguration(@NotNull final PyUnitTestConfiguration configuration, @NotNull final PsiElement elementToRightClickOn) { super.checkConfiguration(configuration, elementToRightClickOn); assertEquals("UnitTest does not obey default working directory", SOME_RANDOM_DIR, configuration.getWorkingDirectorySafe()); } } ); }