void (final String scriptName) { runPythonTest(new PyDebuggerTask("/" + "dynamicTypes", scriptName) { @Override public void before() { PyDebuggerOptionsProvider.getInstance(myFixture.getProject()).setSaveCallSignatures(true); } @Override public void doFinally() { try { PySignatureCacheManagerImpl.CALL_SIGNATURES_ATTRIBUTE.writeAttributeBytes(getVirtualFile(), "".getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { //pass } PyDebuggerOptionsProvider.getInstance(myFixture.getProject()).setSaveCallSignatures(false); } private VirtualFile getVirtualFile() { return LocalFileSystem.getInstance() .refreshAndFindFileByPath( getTestDataPath() + "/dynamicTypes/" + scriptName); } @Override public void testing() throws Exception { waitForTerminate(); EdtTestUtil.runInEdtAndWait(() -> { myFixture.configureByFile(scriptName); EditorTestUtil.setCaretsAndSelection(myFixture.getEditor(), new EditorTestUtil.CaretAndSelectionState( Lists.newArrayList(new EditorTestUtil.CaretInfo(new LogicalPosition(0, 6), null)), null)); final IntentionAction action = myFixture.findSingleIntention(PyPsiBundle.message("INTN.insert.docstring.stub")); boolean saved = PyCodeInsightSettings.getInstance().INSERT_TYPE_DOCSTUB; try { PyCodeInsightSettings.getInstance().INSERT_TYPE_DOCSTUB = true; myFixture.launchAction(action); myFixture.checkResultByFile("dynamicTypes/" + getTestName(true) + "_after.py"); } finally { PyCodeInsightSettings.getInstance().INSERT_TYPE_DOCSTUB = saved; } }); } }); }