boolean (@NotNull final PsiElement element) { // test_functions.py and test_foo do not contain any TestCase and can't be launched with unittest final PsiFile file = element.getContainingFile(); if (file == null) { return true; } final String name = file.getName(); return !(name.endsWith("test_functions.py") || name.endsWith("test_foo.py")); }