package com.iselsoft.ptest.runLineMarker;

import com.intellij.execution.lineMarker.RunLineMarkerContributor;
import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.iselsoft.ptest.runConfiguration.PTestConfigurationProducer;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.Nullable;

public class PTestRunLineMarkerContributor extends RunLineMarkerContributor {
    private static final PTestConfigurationProducer CONFIG_PRODUCER = new PTestConfigurationProducer();
    private static final Function<PsiElement, String> TOOLTIP_PROVIDER = new Function<PsiElement, String>() {
        @Override
        public String fun(PsiElement psiElement) {
            return "Run ptest";
        }
    };

    @Nullable
    @Override
    public Info getInfo(PsiElement psiElement) {
        if (psiElement instanceof PyFunction && CONFIG_PRODUCER.isPTestMethod(psiElement, null)) {
            return new Info(AllIcons.RunConfigurations.TestState.Run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());
        } else if (psiElement instanceof PyClass && CONFIG_PRODUCER.isPTestClass(psiElement, null)) {
            return new Info(AllIcons.RunConfigurations.TestState.Run_run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());
        }
        return null;
    }
}

@@ -1219,32 +1219,54 @@
 ement, null)) %7B%0A
+            try %7B%0A    
             retu
@@ -1373,32 +1373,221 @@
 .getActions());%0A
+            %7D catch (NoSuchFieldError e) %7B%0A                return new Info(AllIcons.RunConfigurations.TestState.Run, TOOLTIP_PROVIDER, PTestRunLineMarkerAction.getActions());%0A            %7D%0A
         %7D%0A      

Fix no run_run icon in old pycharm version.