Mercurial > p > roundup > code
diff test/test_liveserver.py @ 6459:0e86ea84e59d
Debugging and test fixes for CI
test_compression_br worked on my box under python 3.6. In CI it worked
in 3.4 but failed on all other versions 3.6,7,8,9,dev. Error:
json_dict = json.loads(b2s(brotli.decompress(f.content)))
E brotli.error: BrotliDecompress failed
so print f.content.
Also restructured the code to not check for type of f.content. Instead
try json.loads(f.content) and if we get an exception try decompressing. Use
this for br and zstd tests.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 24 Jul 2021 18:23:21 -0400 |
| parents | 8f1b91756457 |
| children | 3d2c17be1d35 |
line wrap: on
line diff
--- a/test/test_liveserver.py Sat Jul 24 16:31:36 2021 -0400 +++ b/test/test_liveserver.py Sat Jul 24 18:23:21 2021 -0400 @@ -529,10 +529,13 @@ }''' content = json.loads(content_str) + print(f.content) + print(type(f.content)) - if (type("") == type(f.content)): + try: json_dict = json.loads(f.content) - else: + except (ValueError): + # Handle error from trying to load compressed data json_dict = json.loads(b2s(brotli.decompress(f.content))) # etag wil not match, creation date different @@ -673,9 +676,12 @@ content = json.loads(content_str) - if (type("") == type(f.content)): + try: json_dict = json.loads(f.content) - else: + except (ValueError, UnicodeDecodeError): + # ValueError - raised by loads on compressed content python2 + # UnicodeDecodeError - raised by loads on compressed content + # python3 json_dict = json.loads(b2s(zstd.decompress(f.content))) # etag wil not match, creation date different
