Add Discord-native hybrid front-end for Jarvis (bot + bridge)
Some checks failed
Release / semantic-release (push) Successful in 59s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 13m45s
Release / build-linux (push) Failing after 7m47s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Some checks failed
Release / semantic-release (push) Successful in 59s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 13m45s
Release / build-linux (push) Failing after 7m47s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
Transform isair/jarvis into a Discord-controlled voice assistant running on the Ubuntu VNC desktop, keeping the mature ~39k-line Python brain intact. - bot/ (Node + bun, discord.js): /자비스 slash commands (ephemeral), voice channel join + voice receive/playback, pluggable VNC screen broadcast (selfbot live / noVNC / screenshot) - bridge/ (Python, Flask): wraps jarvis STT + run_reply_engine + Piper TTS behind a thin localhost HTTP API - .env.example, scripts/ (start_bridge/start_bot/dev), README rewrite, docs/language-comparison.md and docs/vnc-xfce-setup.md Language decision: hybrid (Python brain + Node/bun Discord layer) because Discord blocks bot video; native screen broadcast only works via a Node selfbot library.
This commit is contained in:
65
tests/test_frozen_env_guards.py
Normal file
65
tests/test_frozen_env_guards.py
Normal file
@@ -0,0 +1,65 @@
|
||||
"""
|
||||
Tests for frozen environment (PyInstaller) safety guards.
|
||||
|
||||
These tests verify bundled app behaviour for stdin monitoring
|
||||
and other platform-specific guards.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestStdinMonitorFrozenGuard:
|
||||
"""Tests for stdin_monitor being skipped in bundled (frozen) mode.
|
||||
|
||||
In bundled mode (PyInstaller), sys.stdin may be devnull, so the
|
||||
stdin_monitor thread should not start — the desktop app calls
|
||||
request_stop() directly instead.
|
||||
"""
|
||||
|
||||
def test_stdin_monitor_skipped_in_frozen_mode(self):
|
||||
"""On Windows frozen apps, stdin_monitor should NOT start."""
|
||||
with patch.object(sys, 'platform', 'win32'):
|
||||
with patch.object(sys, 'frozen', True, create=True):
|
||||
should_start = (
|
||||
sys.platform == "win32"
|
||||
and not getattr(sys, 'frozen', False)
|
||||
)
|
||||
assert should_start is False
|
||||
|
||||
def test_stdin_monitor_starts_in_non_frozen_mode(self):
|
||||
"""On Windows non-frozen (dev) mode, stdin_monitor should start."""
|
||||
with patch.object(sys, 'platform', 'win32'):
|
||||
# Remove frozen attribute if present
|
||||
frozen_backup = getattr(sys, 'frozen', None)
|
||||
if hasattr(sys, 'frozen'):
|
||||
delattr(sys, 'frozen')
|
||||
try:
|
||||
should_start = (
|
||||
sys.platform == "win32"
|
||||
and not getattr(sys, 'frozen', False)
|
||||
)
|
||||
assert should_start is True
|
||||
finally:
|
||||
if frozen_backup is not None:
|
||||
sys.frozen = frozen_backup
|
||||
|
||||
def test_stdin_monitor_skipped_on_non_windows(self):
|
||||
"""On non-Windows platforms, stdin_monitor should not start regardless."""
|
||||
for platform in ('darwin', 'linux'):
|
||||
with patch.object(sys, 'platform', platform):
|
||||
should_start = (
|
||||
sys.platform == "win32"
|
||||
and not getattr(sys, 'frozen', False)
|
||||
)
|
||||
assert should_start is False
|
||||
|
||||
def test_stdin_monitor_skipped_on_non_windows_frozen(self):
|
||||
"""On non-Windows frozen apps, stdin_monitor should not start."""
|
||||
with patch.object(sys, 'platform', 'darwin'):
|
||||
with patch.object(sys, 'frozen', True, create=True):
|
||||
should_start = (
|
||||
sys.platform == "win32"
|
||||
and not getattr(sys, 'frozen', False)
|
||||
)
|
||||
assert should_start is False
|
||||
Reference in New Issue
Block a user