Add more local sourced directories for scripts and sounds meaning each user can have own scripts and sound themes when using -x. Hopefully fixed the remainder of the random freeze bug.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import pytest
|
||||
import threading
|
||||
import time
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from fenrirscreenreader.core.eventData import FenrirEventType
|
||||
from fenrirscreenreader.screenDriver.ptyDriver import PTYConstants
|
||||
from fenrirscreenreader.screenDriver.ptyDriver import Terminal
|
||||
@@ -71,10 +74,48 @@ def test_pty_stdin_input_interrupts_output_when_all_keys_interrupt_enabled():
|
||||
}
|
||||
|
||||
pty_driver.interrupt_output_on_stdin_input(b"a")
|
||||
pty_driver.stdin_interrupt_thread.join(timeout=1.0)
|
||||
|
||||
output_manager.interrupt_output.assert_called_once_with()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_pty_stdin_input_interrupt_does_not_block_input_injection():
|
||||
pty_driver = PtyDriver()
|
||||
settings_manager = Mock()
|
||||
settings_manager.get_setting_as_bool.return_value = True
|
||||
settings_manager.get_setting.return_value = ""
|
||||
interrupt_started = threading.Event()
|
||||
release_interrupt = threading.Event()
|
||||
|
||||
def slow_interrupt():
|
||||
interrupt_started.set()
|
||||
release_interrupt.wait(timeout=1.0)
|
||||
|
||||
output_manager = Mock(interrupt_output=Mock(side_effect=slow_interrupt))
|
||||
pty_driver.env = {
|
||||
"input": {"curr_input": []},
|
||||
"runtime": {
|
||||
"SettingsManager": settings_manager,
|
||||
"OutputManager": output_manager,
|
||||
"DebugManager": Mock(write_debug_out=Mock()),
|
||||
},
|
||||
}
|
||||
pty_driver.inject_text_to_screen = Mock()
|
||||
|
||||
start_time = time.monotonic()
|
||||
pty_driver.handle_stdin_input(b"a", Mock())
|
||||
elapsed = time.monotonic() - start_time
|
||||
|
||||
try:
|
||||
assert interrupt_started.wait(timeout=0.2)
|
||||
assert elapsed < 0.2
|
||||
pty_driver.inject_text_to_screen.assert_called_once_with(b"a")
|
||||
finally:
|
||||
release_interrupt.set()
|
||||
pty_driver.stdin_interrupt_thread.join(timeout=1.0)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_pty_stdin_input_honors_interrupt_disabled():
|
||||
pty_driver = PtyDriver()
|
||||
|
||||
Reference in New Issue
Block a user