diff --git a/tests/test_batch.py b/tests/test_batch.py index bb070133..b83b9bcb 100644 --- a/tests/test_batch.py +++ b/tests/test_batch.py @@ -53,7 +53,7 @@ def batch(self, inputs): return torch.stack(inputs) def predict(self, x): - assert len(x) == 2 + assert len(x) == 2, "Expected two concurrent inputs to be batched" return self.model(x) def unbatch(self, output): diff --git a/tests/test_lit_server.py b/tests/test_lit_server.py index 48c3e36f..dcb39677 100644 --- a/tests/test_lit_server.py +++ b/tests/test_lit_server.py @@ -15,7 +15,6 @@ import time from multiprocessing import Pipe, Manager - import os from unittest.mock import patch, MagicMock @@ -30,14 +29,14 @@ def test_new_pipe(lit_server): for _ in range(pool_size): lit_server.new_pipe() - assert len(lit_server.pipe_pool) == 0 - assert len(lit_server.new_pipe()) == 2 + assert len(lit_server.pipe_pool) == 0, "All available pipes from the pipe_pool were used up, which makes it empty" + assert len(lit_server.new_pipe()) == 2, "lit_server.new_pipe() always must return a tuple of read and write pipes" def test_dispose_pipe(lit_server): for i in range(lit_server.max_pool_size + 10): lit_server.dispose_pipe(*Pipe()) - assert len(lit_server.pipe_pool) == lit_server.max_pool_size + assert len(lit_server.pipe_pool) == lit_server.max_pool_size, "pipe_pool size must be less than max_pool_size" def test_index(sync_testclient): @@ -114,8 +113,8 @@ def test_run(): ) time.sleep(5) - assert os.path.exists("client.py") + assert os.path.exists("client.py"), f"Expected client file to be created at {os.getcwd()} after starting the server" output = subprocess.run("python client.py", shell=True, capture_output=True, text=True).stdout - assert '{"output":16.0}' in output + assert '{"output":16.0}' in output, "tests/simple_server.py didn't return expected output" os.remove("client.py") process.kill()