collab-runtime 0.2.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. collab/__init__.py +77 -0
  2. collab/__main__.py +11 -0
  3. collab_runtime-0.2.9.dist-info/METADATA +218 -0
  4. collab_runtime-0.2.9.dist-info/RECORD +82 -0
  5. collab_runtime-0.2.9.dist-info/WHEEL +5 -0
  6. collab_runtime-0.2.9.dist-info/entry_points.txt +3 -0
  7. collab_runtime-0.2.9.dist-info/licenses/LICENSE +21 -0
  8. collab_runtime-0.2.9.dist-info/top_level.txt +10 -0
  9. scripts/cleanup.py +395 -0
  10. scripts/collab_git_hook.py +190 -0
  11. scripts/format_code.py +594 -0
  12. scripts/generate_tests.py +560 -0
  13. scripts/validate_code.py +1397 -0
  14. src/__init__.py +4 -0
  15. src/dashboard/index.html +1131 -0
  16. src/live_locks_watcher.py +1982 -0
  17. src/lock_client.py +4268 -0
  18. src/logging_config.py +259 -0
  19. src/main.py +436 -0
  20. tests/backend/__init__.py +0 -0
  21. tests/backend/functional/__init__.py +0 -0
  22. tests/backend/functional/test_package_imports.py +43 -0
  23. tests/backend/integration/__init__.py +0 -0
  24. tests/backend/integration/test_cli_contract_parity.py +220 -0
  25. tests/backend/performance/__init__.py +0 -0
  26. tests/backend/reliability/__init__.py +0 -0
  27. tests/backend/security/__init__.py +0 -0
  28. tests/backend/unit/live_locks_watcher/__init__.py +5 -0
  29. tests/backend/unit/live_locks_watcher/_helpers.py +123 -0
  30. tests/backend/unit/live_locks_watcher/conftest.py +18 -0
  31. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_dashboard.py +188 -0
  32. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_developer.py +56 -0
  33. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_graceful_shutdown.py +459 -0
  34. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_main.py +1925 -0
  35. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_module.py +187 -0
  36. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_multi_session.py +320 -0
  37. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_notify.py +67 -0
  38. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_parsing.py +155 -0
  39. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_process_helpers.py +684 -0
  40. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_processing.py +173 -0
  41. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_prompt_abort.py +71 -0
  42. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_reconcile.py +516 -0
  43. tests/backend/unit/live_locks_watcher/test_live_locks_watcher_scan.py +296 -0
  44. tests/backend/unit/lock_client/__init__.py +1 -0
  45. tests/backend/unit/lock_client/_helpers.py +132 -0
  46. tests/backend/unit/lock_client/test_lock_client_acquire.py +214 -0
  47. tests/backend/unit/lock_client/test_lock_client_active.py +104 -0
  48. tests/backend/unit/lock_client/test_lock_client_api.py +63 -0
  49. tests/backend/unit/lock_client/test_lock_client_cli.py +682 -0
  50. tests/backend/unit/lock_client/test_lock_client_daemon.py +3730 -0
  51. tests/backend/unit/lock_client/test_lock_client_dashboard.py +438 -0
  52. tests/backend/unit/lock_client/test_lock_client_discover.py +241 -0
  53. tests/backend/unit/lock_client/test_lock_client_force_release.py +354 -0
  54. tests/backend/unit/lock_client/test_lock_client_helper_branches.py +1890 -0
  55. tests/backend/unit/lock_client/test_lock_client_history.py +301 -0
  56. tests/backend/unit/lock_client/test_lock_client_isolation.py +316 -0
  57. tests/backend/unit/lock_client/test_lock_client_pid.py +75 -0
  58. tests/backend/unit/lock_client/test_lock_client_reconcile.py +464 -0
  59. tests/backend/unit/lock_client/test_lock_client_release.py +77 -0
  60. tests/backend/unit/lock_client/test_lock_client_shutdown.py +1110 -0
  61. tests/backend/unit/lock_client/test_lock_client_utils.py +474 -0
  62. tests/backend/unit/lock_client/test_lock_client_watch.py +866 -0
  63. tests/backend/unit/scripts/__init__.py +1 -0
  64. tests/backend/unit/scripts/_helpers.py +42 -0
  65. tests/backend/unit/scripts/test_cleanup.py +285 -0
  66. tests/backend/unit/scripts/test_collab_git_hook.py +280 -0
  67. tests/backend/unit/scripts/test_collab_git_hook_ported.py +50 -0
  68. tests/backend/unit/scripts/test_format_code.py +368 -0
  69. tests/backend/unit/scripts/test_format_code_ported.py +177 -0
  70. tests/backend/unit/scripts/test_generate_tests.py +305 -0
  71. tests/backend/unit/scripts/test_hook_templates.py +357 -0
  72. tests/backend/unit/scripts/test_setup_hook_overlay.py +95 -0
  73. tests/backend/unit/scripts/test_validate_code.py +867 -0
  74. tests/backend/unit/scripts/test_validate_code_ported.py +237 -0
  75. tests/backend/unit/test_entrypoints_main_run.py +83 -0
  76. tests/backend/unit/test_logging_config.py +529 -0
  77. tests/backend/unit/test_main_watch_pid_file.py +278 -0
  78. tests/conftest.py +167 -0
  79. tests/frontend/__init__.py +0 -0
  80. tests/frontend/jest/__init__.py +0 -0
  81. tests/frontend/playwright/__init__.py +0 -0
  82. tests/packaging/test_smoke_install.py +76 -0
@@ -0,0 +1,95 @@
1
+ """Regression tests for setup-script collab hook overlay wiring."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from tests.backend.unit.scripts._helpers import ROOT
6
+
7
+
8
+ def _script_text(relative_path: str) -> str:
9
+ return (ROOT / relative_path).read_text(encoding="utf-8")
10
+
11
+
12
+ def test_setup_ps1_overlays_collab_hooks_after_pre_commit_install():
13
+ text = _script_text("scripts/setup.ps1")
14
+
15
+ install_index = text.index("& $preCommitExe install --hook-type $type --overwrite")
16
+ overlay_index = text.index('$sourceHooksDir = Join-Path $projectRoot "hooks"')
17
+
18
+ assert overlay_index > install_index
19
+ assert '$targetHooksDir = Join-Path $projectRoot ".git\\hooks"' in text
20
+ assert (
21
+ '$hookNames = @("pre-commit", "post-commit", "pre-push", "commit-msg")' in text
22
+ )
23
+ assert "Copy-Item -Path $src -Destination $dst -Force" in text
24
+ assert "Collab hook overlay installed " in text
25
+ assert "Collab hook templates missing (hooks/) " in text
26
+
27
+
28
+ def test_setup_ps1_only_overlays_after_successful_hook_install():
29
+ text = _script_text("scripts/setup.ps1")
30
+
31
+ success_branch = text.index("if (-not $hookInstallFailed) {")
32
+ overlay_index = text.index('$sourceHooksDir = Join-Path $projectRoot "hooks"')
33
+ warn_branch = text.index(
34
+ 'Write-Host " Git hook installation " ' "-NoNewline -ForegroundColor White"
35
+ )
36
+
37
+ assert success_branch < overlay_index < warn_branch
38
+
39
+
40
+ def test_setup_sh_runs_install_hooks_after_pre_commit_install():
41
+ text = _script_text("scripts/setup.sh")
42
+
43
+ install_index = text.index(
44
+ 'if ! pre-commit install --hook-type "$hook_type" '
45
+ "--overwrite >/dev/null 2>&1; then"
46
+ )
47
+ overlay_index = text.index('if [ -f "$PROJECT_ROOT/install_hooks.sh" ]; then')
48
+
49
+ assert overlay_index > install_index
50
+ assert 'if sh "$PROJECT_ROOT/install_hooks.sh" >/dev/null 2>&1; then' in text
51
+ assert 'print_success "Collab hook overlay installed"' in text
52
+ assert "Warning: collab hook overlay installation failed." in text
53
+ assert "Warning: install_hooks.sh not found." in text
54
+
55
+
56
+ def test_setup_sh_only_overlays_in_success_branch():
57
+ text = _script_text("scripts/setup.sh")
58
+
59
+ success_branch = text.index("if [ $HOOK_INSTALL_FAILED -eq 0 ]; then")
60
+ overlay_index = text.index('if [ -f "$PROJECT_ROOT/install_hooks.sh" ]; then')
61
+ warn_branch = text.index(
62
+ 'echo " ${YELLOW}Warning: pre-commit hook installation failed.${NC}" ' ">&2"
63
+ )
64
+
65
+ assert success_branch < overlay_index < warn_branch
66
+
67
+
68
+ def test_setup_dev_ps1_installs_vscode_extension_dependencies_from_root_path():
69
+ text = _script_text("scripts/setup-dev.ps1")
70
+
71
+ assert (
72
+ '$vscodeExtDir = Join-Path $projectRoot "vscode-extension\\collab-locks"'
73
+ in text
74
+ )
75
+ assert "npm install --silent 2>$null" in text
76
+ assert "VS Code extension dependencies installed " in text
77
+
78
+
79
+ def test_setup_dev_ps1_pycharm_installs_run_config():
80
+ text = _script_text("scripts/setup-dev.ps1")
81
+
82
+ assert '"jetbrains"' in text
83
+ assert (
84
+ '$ideaRunConfigDir = Join-Path $projectRoot ".idea\\runConfigurations"' in text
85
+ )
86
+ assert '$xmlSrc = Join-Path $projectRoot "pycharm\\Collab_Lock_Watcher.xml"' in text
87
+ assert "Copy-Item -Path $xmlSrc" in text
88
+ assert "PyCharm run configuration installed " in text
89
+
90
+
91
+ def test_install_hooks_sh_includes_commit_msg():
92
+ text = _script_text("install_hooks.sh")
93
+
94
+ assert "commit-msg" in text
95
+ assert "pre-commit post-commit pre-push commit-msg" in text