mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 01:41:57 -04:00
Merge pull request #9640 from ThomasWaldmann/backport-9633-to-1.4-maint
Some checks are pending
CI / lint (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
Some checks are pending
CI / lint (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
tests: make FakeInput usage less suspicious for code checkers
This commit is contained in:
commit
789c5060d6
2 changed files with 7 additions and 4 deletions
|
|
@ -432,6 +432,9 @@ class FakeInputs:
|
|||
def __init__(self, inputs):
|
||||
self.inputs = inputs
|
||||
|
||||
def available(self):
|
||||
return bool(self.inputs)
|
||||
|
||||
def __call__(self, prompt=None):
|
||||
if prompt is not None:
|
||||
print(prompt, end='')
|
||||
|
|
|
|||
|
|
@ -796,21 +796,21 @@ class TestBuffer:
|
|||
def test_yes_input():
|
||||
inputs = list(TRUISH)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert yes(input=input)
|
||||
inputs = list(FALSISH)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert not yes(input=input)
|
||||
|
||||
|
||||
def test_yes_input_defaults():
|
||||
inputs = list(DEFAULTISH)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert yes(default=True, input=input)
|
||||
input = FakeInputs(inputs)
|
||||
for i in inputs:
|
||||
while input.available():
|
||||
assert not yes(default=False, input=input)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue