mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Add en passant santization tests to the CI and pos is ok
closes https://github.com/official-stockfish/Stockfish/pull/6615 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
cf559b2c17
commit
5b5986b095
@@ -126,6 +126,11 @@ class TimeoutException(Exception):
|
||||
self.message = message
|
||||
self.timeout = timeout
|
||||
|
||||
class UnexpectedOutputException(Exception):
|
||||
def __init__(self, actual: str, expected: str):
|
||||
self.actual = actual
|
||||
self.expected = expected
|
||||
|
||||
|
||||
def timeout_decorator(timeout: float):
|
||||
def decorator(func):
|
||||
@@ -230,6 +235,11 @@ class MiniTestFramework:
|
||||
f" {method} (hit execution limit of {e.timeout} seconds)"
|
||||
)
|
||||
|
||||
if isinstance(e, UnexpectedOutputException):
|
||||
self.print_failure(
|
||||
f" {method} encountered unexpeted output: \"{e.actual}\" when output matching \"{e.expected}\" was expected"
|
||||
)
|
||||
|
||||
if isinstance(e, AssertionError):
|
||||
self.__handle_assertion_error(t0, method)
|
||||
|
||||
@@ -371,6 +381,15 @@ class Stockfish:
|
||||
if callback(line) == True:
|
||||
return
|
||||
|
||||
@timeout_decorator(MAX_TIMEOUT)
|
||||
def expect_for_line_matching(self, line_match: str, expected: str):
|
||||
for line in self.readline():
|
||||
if fnmatch.fnmatch(line, line_match):
|
||||
if fnmatch.fnmatch(line, expected):
|
||||
break
|
||||
else:
|
||||
raise UnexpectedOutputException(line, expected)
|
||||
|
||||
def readline(self):
|
||||
if not self.process:
|
||||
raise RuntimeError("Stockfish process is not started")
|
||||
|
||||
Reference in New Issue
Block a user