PyFunction (@NotNull final String folder) { final PyFile file = (PyFile)myFixture.configureByFile(String.format("configurationByContext/%s/test_foo.py", folder)); assert file != null; final PyFunction function = file.findTopLevelFunction("test_test"); assert function != null; return function; }