adjust stack_offset for test_limbo_cli

This commit is contained in:
pedrocarlo 2025-04-04 00:54:48 -03:00
parent 4c0bd50ac9
commit 321def3c30

View file

@ -75,11 +75,14 @@ class LimboShell:
def _handle_error(self) -> bool:
while True:
error_output = self.pipe.stderr.read(PIPE_BUF)
if error_output == b"":
return True
console.error(error_output.decode(), end="")
return False
ready, _, errors = select.select(
[self.pipe.stderr], [], [self.pipe.stderr], 0
)
if not (ready + errors):
break
error_output = self.pipe.stderr.read(PIPE_BUF).decode()
console.error(error_output, end="", _stack_offset=2)
raise RuntimeError("Error encountered in Limbo shell.")
@staticmethod
def _clean_output(output: str, marker: str) -> str:
@ -129,7 +132,7 @@ INSERT INTO t VALUES (zeroblob(1024 - 1), zeroblob(1024 - 2), zeroblob(1024 - 3)
self.shell.quit()
def run_test(self, name: str, sql: str, expected: str) -> None:
console.info(f"Running test: {name}")
console.info(f"Running test: {name}", _stack_offset=2)
actual = self.shell.execute(sql)
assert actual == expected, (
f"Test failed: {name}\n"
@ -139,9 +142,9 @@ INSERT INTO t VALUES (zeroblob(1024 - 1), zeroblob(1024 - 2), zeroblob(1024 - 3)
)
def debug_print(self, sql: str):
console.debug(f"debugging: {sql}")
console.debug(f"debugging: {sql}", _stack_offset=2)
actual = self.shell.execute(sql)
console.debug(f"OUTPUT:\n{repr(actual)}")
console.debug(f"OUTPUT:\n{repr(actual)}", _stack_offset=2)
def run_test_fn(
self, sql: str, validate: Callable[[str], bool], desc: str = ""
@ -149,7 +152,7 @@ INSERT INTO t VALUES (zeroblob(1024 - 1), zeroblob(1024 - 2), zeroblob(1024 - 3)
# Print the test that is executing before executing the sql command
# Printing later confuses the user of the code what test has actually failed
if desc:
console.info(f"Testing: {desc}")
console.info(f"Testing: {desc}", _stack_offset=2)
actual = self.shell.execute(sql)
assert validate(actual), f"Test failed\nSQL: {sql}\nActual:\n{repr(actual)}"