From 71c3ad63b39304be3adae17e2bd51970695d4d22 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 11 Sep 2023 01:46:25 +0000 Subject: [PATCH] fix tests --- tests/test_httpcli.py | 5 ++++- tests/util.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_httpcli.py b/tests/test_httpcli.py index 54a3c470..22b5ce0a 100644 --- a/tests/test_httpcli.py +++ b/tests/test_httpcli.py @@ -119,8 +119,11 @@ class TestHttpCli(unittest.TestCase): # with open(os.path.join(td, "tar"), "wb") as f: # f.write(b) try: - tar = tarfile.open(fileobj=io.BytesIO(b)).getnames() + tar = tarfile.open(fileobj=io.BytesIO(b), mode="r|").getnames() except: + if "HTTP/1.1 403 Forbidden" not in h and b != b"\nJ2EOT": + eprint("bad tar?", url, h, b) + raise tar = [] tar = [x.split("/", 1)[1] for x in tar] tar = ["/".join([y for y in [top, durl, x] if y]) for x in tar] diff --git a/tests/util.py b/tests/util.py index c51406c8..d58b0a48 100644 --- a/tests/util.py +++ b/tests/util.py @@ -20,7 +20,7 @@ ANYWIN = WINDOWS or sys.platform in ["msys"] MACOS = platform.system() == "Darwin" J2_ENV = jinja2.Environment(loader=jinja2.BaseLoader) -J2_FILES = J2_ENV.from_string("{{ files|join('\n') }}") +J2_FILES = J2_ENV.from_string("{{ files|join('\n') }}\nJ2EOT") def nah(*a, **ka): @@ -109,13 +109,13 @@ class Cfg(Namespace): def __init__(self, a=None, v=None, c=None): ka = {} - ex = "daw dav_auth dav_inf dav_mac dav_rt dotsrch e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp force_js getmod grid hardlink ih ihead magic never_symlink nid nih no_acode no_athumb no_dav no_dedup no_del no_dupe no_logues no_mv no_readme no_robots no_sb_md no_sb_lg no_scandir no_thumb no_vthumb no_zip nrand nw rand smb th_no_crop vague_403 vc ver xdev xlink xvol" + ex = "daw dav_auth dav_inf dav_mac dav_rt dotsrch e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp force_js getmod grid hardlink ih ihead magic never_symlink nid nih no_acode no_athumb no_dav no_dedup no_del no_dupe no_logues no_mv no_readme no_robots no_sb_md no_sb_lg no_scandir no_tarcmp no_thumb no_vthumb no_zip nrand nw rand smb th_no_crop vague_403 vc ver xdev xlink xvol" ka.update(**{k: False for k in ex.split()}) ex = "dotpart no_rescan no_sendfile no_voldump plain_ip" ka.update(**{k: True for k in ex.split()}) - ex = "css_browser hist js_browser no_forget no_hash no_idx" + ex = "css_browser hist js_browser no_forget no_hash no_idx nonsus_urls" ka.update(**{k: None for k in ex.split()}) ex = "s_thead s_tbody th_convt"