A way to filter out non-relevant environments
[idea/community.git] / python / testSrc / com / jetbrains / env / PyTestTask.java
1 package com.jetbrains.env;
2
3 import com.google.common.collect.Sets;
4 import com.jetbrains.python.psi.LanguageLevel;
5 import org.jetbrains.annotations.NotNull;
6 import org.jetbrains.annotations.Nullable;
7
8 import java.util.Set;
9
10 /**
11  * @author traff
12  */
13 public abstract class PyTestTask {
14   private String myScriptName;
15   private String myScriptParameters;
16
17
18
19   public void setScriptName(String scriptName) {
20     myScriptName = scriptName;
21   }
22
23   public void setScriptParameters(String scriptParameters) {
24     myScriptParameters = scriptParameters;
25   }
26
27   public void setUp(String testName) throws Exception {
28   }
29
30   public void tearDown() throws Exception {
31   }
32
33   /**
34    * Run test on certain SDK path.
35    * To create SDK from path, use {@link PyExecutionFixtureTestTask#createTempSdk(String, com.jetbrains.python.sdkTools.SdkCreationType)}
36    *
37    * @param sdkHome sdk path
38    */
39   public abstract void runTestOn(String sdkHome) throws Exception;
40
41   public void before() throws Exception {
42   }
43
44   public void testing() throws Exception {
45   }
46
47   public void after() throws Exception {
48   }
49
50   public void doFinally() {
51   }
52
53   public void useNormalTimeout() {
54   }
55
56   public void useLongTimeout() {
57   }
58
59   public String getScriptName() {
60     return myScriptName;
61   }
62
63
64
65   public String getScriptParameters() {
66     return myScriptParameters;
67   }
68
69
70   /**
71    * @return tags this task needs to exist on interpreter to run
72    */
73   @NotNull
74   public Set<String> getTags() {
75     return Sets.newHashSet();
76   }
77
78   /**
79    * Checks if task supports this language level
80    * @param level level to check
81    * @return true if supports
82    */
83   public boolean isLanguageLevelSupported(@NotNull final LanguageLevel level) {
84     return true;
85   }
86
87   /**
88    * Provides a way to filter out non-relevant environments
89    *
90    * @return the set of a tags that interpreter should run on, if an environment doesn't contain one of them, it won't be
91    * used to run this test task.
92    * null in case filtering shouldn't be used
93    */
94   @Nullable
95   public Set<String> getTagsToCover() {
96     return null;
97   }
98 }