fix(hooks): ignore optional hook failures
CI / Capabilities and shell quality (push) Successful in 11s
CI / Python tests and compilation (push) Successful in 11s
CI / PowerShell tests on Ubuntu (push) Successful in 27s
CI / CI configuration security checks (push) Successful in 4s
CI / Build and inspect generated packages (push) Successful in 6s
CI / Qwen retrieval integration (push) Successful in 14m17s
CI / Bash integration and installation guards (push) Successful in 16s
CI / Installed client configuration smoke tests (push) Successful in 13s
CI / Capabilities and shell quality (push) Successful in 11s
CI / Python tests and compilation (push) Successful in 11s
CI / PowerShell tests on Ubuntu (push) Successful in 27s
CI / CI configuration security checks (push) Successful in 4s
CI / Build and inspect generated packages (push) Successful in 6s
CI / Qwen retrieval integration (push) Successful in 14m17s
CI / Bash integration and installation guards (push) Successful in 16s
CI / Installed client configuration smoke tests (push) Successful in 13s
This commit is contained in:
1 parent
cacb41fe28
commit
13eefe3309
9 files changed
+60
-20
No files matched your search
@@ -186,6 +186,36 @@ class SessionStateHookTests(unittest.TestCase):
|
||||
self.assertEqual(self.run_hook(shell, executable, hook, config, workspace, ''), '')
|
||||
self.assertEqual(list(workspace.iterdir()), [])
|
||||
|
||||
def test_hooks_ignore_missing_helper(self):
|
||||
for shell, executable in SHELLS:
|
||||
if not executable or not Path(executable).exists():
|
||||
continue
|
||||
with self.subTest(shell=shell), tempfile.TemporaryDirectory() as directory:
|
||||
base = Path(directory)
|
||||
config = base / 'config'
|
||||
shutil.copytree(ROOT / 'shared/hooks/scripts', config / 'hooks/scripts')
|
||||
(config / 'hooks/scripts/session-state.py').unlink()
|
||||
workspace = base / 'workspace'
|
||||
workspace.mkdir()
|
||||
for hook in ('pointer', 'compact'):
|
||||
self.assertEqual(self.run_hook(shell, executable, hook, config, workspace, ''), '')
|
||||
|
||||
def test_flashbang_ignores_unavailable_runtime(self):
|
||||
for shell, executable in SHELLS:
|
||||
if not executable or not Path(executable).exists():
|
||||
continue
|
||||
with self.subTest(shell=shell):
|
||||
environment = dict(os.environ)
|
||||
if shell == 'powershell':
|
||||
environment['LOCALAPPDATA'] = ''
|
||||
command = [executable, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File',
|
||||
str(ROOT / 'shared/hooks/flashbang.ps1')]
|
||||
else:
|
||||
environment['PATH'] = ''
|
||||
command = [executable, str(ROOT / 'shared/hooks/flashbang.sh')]
|
||||
result = subprocess.run(command, env=environment, capture_output=True, text=True, timeout=20)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user