tenseleyflow/bensch / dad0c73

Browse files

add capability-gated suite selection

Runner checks profile capabilities and skip list before running
each YAML spec. Shells without readline skip editing/history/
completion. Shells without vi_mode skip vi_mode.yaml. Profile
skip list patterns are matched against spec file paths.

Skipped suites show clear [SKIP] message with reason.
Authored by espadonne
SHA
dad0c73942eec09c29b78d78c82ea945e7ba2fc6
Parents
4bf25d7
Tree
7fad81a

1 changed file

StatusFile+-
M framework/runner.py 25 0
framework/runner.pymodified
@@ -195,6 +195,25 @@ class YAMLTestRunner:
195195
             self._current_session = None
196196
             gc.collect()
197197
 
198
+    def should_skip_spec(self, spec_path: Path) -> Optional[str]:
199
+        """Check if a spec file should be skipped based on profile capabilities."""
200
+        skip_list = self.profile.get("suites", {}).get("skip", [])
201
+        # Check if any skip pattern matches the spec path
202
+        spec_str = str(spec_path)
203
+        for pattern in skip_list:
204
+            if pattern in spec_str:
205
+                return pattern
206
+        # Check capability requirements
207
+        caps = self.profile.get("capabilities", {})
208
+        spec_name = spec_path.stem.lower()
209
+        if "vi_mode" in spec_name and not caps.get("vi_mode", False):
210
+            return "shell lacks vi_mode capability"
211
+        if "completion" in spec_name and not caps.get("command_completion", False):
212
+            return "shell lacks command_completion capability"
213
+        if ("line_editing" in spec_name or "history" in spec_name) and not caps.get("readline", False):
214
+            return "shell lacks readline capability"
215
+        return None
216
+
198217
     def run_spec_file(self, spec_path: Path) -> List[TestResult]:
199218
         """
200219
         Run all tests in a YAML spec file.
@@ -205,6 +224,12 @@ class YAMLTestRunner:
205224
         Returns:
206225
             List of TestResult objects
207226
         """
227
+        # Check if this suite should be skipped for this shell
228
+        skip_reason = self.should_skip_spec(spec_path)
229
+        if skip_reason:
230
+            print(f"\n{Fore.YELLOW}[SKIP]{Style.RESET_ALL} {spec_path.name} — {skip_reason}")
231
+            return []
232
+
208233
         with open(spec_path) as f:
209234
             spec = yaml.safe_load(f)
210235