84 versions = self.getVersions(interpreter) |
84 versions = self.getVersions(interpreter) |
85 if "plugins" in versions: |
85 if "plugins" in versions: |
86 return any(plugin["name"] == "pytest-cov" for plugin in versions["plugins"]) |
86 return any(plugin["name"] == "pytest-cov" for plugin in versions["plugins"]) |
87 |
87 |
88 return False |
88 return False |
|
89 |
|
90 def supportsMarkers(self, interpreter): |
|
91 """ |
|
92 Public method to indicate the support for test filtering using markers and/or |
|
93 marker expressions. |
|
94 |
|
95 @param interpreter interpreter to be used for the test |
|
96 @type str |
|
97 @return flag indicating support of markers |
|
98 @rtype bool |
|
99 """ |
|
100 return True |
|
101 |
|
102 def getMarkers(self, interpreter, workdir): |
|
103 """ |
|
104 Public method to get the list of defined markers. |
|
105 |
|
106 @param interpreter interpreter to be used for the test |
|
107 @type str |
|
108 @param workdir name of the working directory |
|
109 @type str |
|
110 @return dictionary containing the marker as key and the associated description |
|
111 as value |
|
112 @rtype dict |
|
113 """ |
|
114 proc = QProcess() |
|
115 proc.setWorkingDirectory(workdir) |
|
116 proc.start(interpreter, [PytestExecutor.runner, "markers"]) |
|
117 if proc.waitForFinished(3000): |
|
118 exitCode = proc.exitCode() |
|
119 if exitCode == 0: |
|
120 outputLines = self.readAllOutput(proc).splitlines() |
|
121 for line in outputLines: |
|
122 if line.startswith("{") and line.endswith("}"): |
|
123 with contextlib.suppress(json.JSONDecodeError): |
|
124 return json.loads(line) |
|
125 |
|
126 return {} |
89 |
127 |
90 def createArguments(self, config): |
128 def createArguments(self, config): |
91 """ |
129 """ |
92 Public method to create the arguments needed to start the test process. |
130 Public method to create the arguments needed to start the test process. |
93 |
131 |
119 |
157 |
120 if config.collectCoverage: |
158 if config.collectCoverage: |
121 args.extend(["--cov=.", "--cov-report="]) |
159 args.extend(["--cov=.", "--cov-report="]) |
122 if not config.eraseCoverage: |
160 if not config.eraseCoverage: |
123 args.append("--cov-append") |
161 args.append("--cov-append") |
|
162 |
|
163 if config.testMarkerExpression: |
|
164 args.append("-m") |
|
165 args.append(config.testMarkerExpression) |
124 |
166 |
125 if config.testFilename: |
167 if config.testFilename: |
126 if config.testName: |
168 if config.testName: |
127 args.append( |
169 args.append( |
128 "{0}::{1}".format( |
170 "{0}::{1}".format( |