From 9dcf1ba2e0f571df76edd39a1df4109fef1275ef Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 7 Apr 2024 08:40:19 +0530 Subject: [PATCH] Output stderr from curl when test fails --- src/calibre/srv/tests/auth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calibre/srv/tests/auth.py b/src/calibre/srv/tests/auth.py index 09d8fa8714..34652436a7 100644 --- a/src/calibre/srv/tests/auth.py +++ b/src/calibre/srv/tests/auth.py @@ -234,11 +234,11 @@ class TestAuth(BaseTest): curl = shutil.which('curl') if curl: def docurl(data, *args): - cmd = [curl] + list(args) + ['http://localhost:%d/closed' % server.address[1]] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) - x = p.stdout.read() + cmd = [curl, '--silent'] + list(args) + ['http://localhost:%d/closed' % server.address[1]] + p = subprocess.Popen(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = p.communicate() p.wait() - self.ae(x, data) + self.ae(stdout, data, f'stderr:\n{stderr.decode(errors="replace")}') docurl(b'') docurl(b'', '--digest', '--user', 'xxxx:testpw') docurl(b'', '--digest', '--user', 'testuser:xtestpw')