boolean (@NotNull final PyToxConfiguration configuration, @NotNull final ConfigurationContext context, @NotNull final Ref<PsiElement> sourceElement) { final PsiFile file = sourceElement.get().getContainingFile(); if (file == null) { return false; } final String envName = PyToxTestLocator.getEnvNameFromElement(file); if (envName != null) { configuration.setRunOnlyEnvs(envName); configuration.setName(String.format("tox: run on %s", envName)); return true; } final PsiDirectory directory = file.getContainingDirectory(); if (directory == null) { return false; } configuration.setWorkingDirectory(directory.getVirtualFile().getCanonicalPath()); if (TOX_FILE_NAME.equals(file.getName())) { configuration.setName("tox"); return true; } return false; }