From: Noel Power Date: Thu, 28 Mar 2024 09:09:02 +0000 (+0000) Subject: selftest: fix potential reference before assigned error X-Git-Tag: ldb-2.8.1~86 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a269412c71ee05019b3ab8a38bcea727963ae22b;p=thirdparty%2Fsamba.git selftest: fix potential reference before assigned error This would only happen if the test failed (but the message would be incorrect as 'e' the exception to be stringified doesn't exist. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15611 Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett (cherry picked from commit efdbf0511e0a89f865210170001fbebf17a45278) --- diff --git a/python/samba/tests/blackbox/http_chunk.py b/python/samba/tests/blackbox/http_chunk.py index 175c60d98a2..150ab2a3153 100644 --- a/python/samba/tests/blackbox/http_chunk.py +++ b/python/samba/tests/blackbox/http_chunk.py @@ -99,7 +99,7 @@ class HttpChunkBlackboxTests(BlackboxTestCase): try: msg = "snglechunksnglechunksnglechunksnglechunksnglechunk" resp = self.check_output("%s -d11 -U%% -I%s --rsize 49 --uri %s" % (COMMAND, os.getenv("SERVER_IP", "localhost"), msg)) - self.fail(str(e)) + self.fail("unexpected success") except BlackboxProcessError as e: if "http_read_chunk: size 50 exceeds max content len 49 skipping body" not in e.stderr.decode('utf-8'): self.fail(str(e)) diff --git a/python/samba/tests/blackbox/http_content.py b/python/samba/tests/blackbox/http_content.py index 9ecb6ffe279..3d674aa8db7 100644 --- a/python/samba/tests/blackbox/http_content.py +++ b/python/samba/tests/blackbox/http_content.py @@ -77,7 +77,7 @@ class HttpContentBlackboxTests(BlackboxTestCase): msg = "012345678" # 9 bytes # limit response to 8 bytes resp = self.check_output("%s -d11 -U%% -I%s --rsize 8 --uri %s" % (COMMAND, os.getenv("SERVER_IP", "localhost"), msg)) - self.fail(str(e)) + self.fail("unexpected success") except BlackboxProcessError as e: if "unexpected 0 len response" not in e.stdout.decode('utf-8'): self.fail(str(e))