GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — devstack/scripts/test_localpibox_install_openspec.py at docs · lpb-stack/devstack

Expand file tree

/

test_localpibox_install_openspec.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
79 lines (58 loc) · 2.73 KB
/

test_localpibox_install_openspec.py

Copy path

File metadata and controls

79 lines (58 loc) · 2.73 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python3
"""support/install-openspec tests: skip when installed, install
retries, init new/existing, verify, target resolution."""
from __future__ import annotations
from testharness import run_lpbx_suite, _quiet_console
from unittest import mock
import importlib
iospec = importlib.import_module('install-openspec')
def test_openspec_skips_when_installed(tmpdir):
cons = _quiet_console()
with mock.patch.object(iospec, "which", return_value="/bin/openspec"), \
mock.patch.object(iospec, "run_cmd", return_value=("1.2.3", "", 0)):
assert iospec.install_openspec(cons) == 0
assert "already installed" in cons.out.getvalue()
def test_openspec_install_retries_then_fails(tmpdir):
cons = _quiet_console()
with mock.patch.object(iospec, "which", return_value=None), \
mock.patch.object(iospec, "run_cmd", return_value=("", "npm err", 1)), \
mock.patch.object(iospec.time, "sleep", return_value=None):
assert iospec.install_openspec(cons) == 1
assert "3 attempts" in cons.err.getvalue()
def test_openspec_init_new(tmpdir):
target = tmpdir / "proj"
target.mkdir()
cons = _quiet_console()
with mock.patch.object(iospec, "run_cmd", return_value=("", "", 0)) as m:
assert iospec.init_openspec(target, cons) == 0
assert m.call_args.args[0] == ["openspec", "init", "--tools", "pi"]
def test_openspec_init_existing_runs_update(tmpdir):
target = tmpdir / "proj"
(target / "openspec").mkdir(parents=True)
cons = _quiet_console()
with mock.patch.object(iospec, "run_cmd", return_value=("", "", 0)) as m:
assert iospec.init_openspec(target, cons) == 0
assert m.call_args.args[0] == ["openspec", "update"]
def test_openspec_verify(tmpdir):
target = tmpdir / "proj"
(target / "openspec").mkdir(parents=True)
(target / "openspec" / "config.yaml").write_text("x")
(target / ".pi" / "prompts").mkdir(parents=True)
(target / ".pi" / "prompts" / "opsx-propose.md").write_text("x")
(target / ".pi" / "prompts" / "opsx-apply.md").write_text("x")
(target / ".pi" / "skills" / "openspec-foo").mkdir(parents=True)
cons = _quiet_console()
assert iospec.verify_installation(target, cons) == 0
assert "2 command files" in cons.out.getvalue()
def test_openspec_verify_missing_openspec(tmpdir):
target = tmpdir / "proj"
target.mkdir()
cons = _quiet_console()
assert iospec.verify_installation(target, cons) == 1
assert "missing" in cons.err.getvalue()
def test_openspec_resolve_target(tmpdir):
assert iospec.resolve_target_dir(str(tmpdir)) == tmpdir.resolve()
def main() -> int:
return run_lpbx_suite("install-openspec tests", globals())
if __name__ == "__main__":
raise SystemExit(main())
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.