From 83965e907ef5e9f24a3536ddca28e52e40e56d3e Mon Sep 17 00:00:00 2001 From: YX Hao Date: Sat, 16 Mar 2024 10:59:47 +0800 Subject: [PATCH] Fix new python tests for Windows --- .github/workflows/github-CI-Windows.yml | 2 ++ testenv/Makefile.am | 2 +- testenv/Test-k.py | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/github-CI-Windows.yml b/.github/workflows/github-CI-Windows.yml index 7eef379c..e177261f 100644 --- a/.github/workflows/github-CI-Windows.yml +++ b/.github/workflows/github-CI-Windows.yml @@ -82,6 +82,8 @@ jobs: python3 -c "import sys; print(sys.executable)" rm /$mingw/bin/python* 2>/dev/null #pacman -R -dd --noconfirm mingw-w64-${{env.arch}}-python 2>/dev/null + python.exe -V + python.exe -c "import sys; print(sys.executable)" # MinGW-w64 pre-installed - name: Show setup result diff --git a/testenv/Makefile.am b/testenv/Makefile.am index 302b8760..1d42714d 100644 --- a/testenv/Makefile.am +++ b/testenv/Makefile.am @@ -51,7 +51,6 @@ DEFAULT_TESTS = \ Test-cookie-expires.py \ Test-cookie.py \ Test-Head.py \ - Test-https-k.py \ Test-k.py \ Test-missing-scheme-retval.py \ Test-O.py \ @@ -68,6 +67,7 @@ DEFAULT_TESTS = \ HTTPS_TESTS = \ Test-hsts.py \ + Test-https-k.py \ Test--https.py \ Test--https-crl.py \ Test-pinnedpubkey-der-https.py \ diff --git a/testenv/Test-k.py b/testenv/Test-k.py index 342887c0..bee61887 100755 --- a/testenv/Test-k.py +++ b/testenv/Test-k.py @@ -14,6 +14,14 @@ characterset based on the current OS """ +# MINGW32_NT-10.0-20348/MINGW64_NT-10.0-20348: requires Linux flavor +if platform.system()[0:10] in ["MINGW32_NT", "MINGW64_NT", "Windows"]: + converted_filename = "site;sub%3A.html" + converted_linkpath = "site%3Bsub%253A.html" +else: + converted_filename = "site;sub:.html" + converted_linkpath = "./site%3Bsub:.html" + ############################## File Definitions ############################## index = """ @@ -26,16 +34,16 @@ """ -converted = """ +converted = ''' Index - Site + Site -""" +''' site = """ @@ -50,6 +58,7 @@ IndexPage = WgetFile("index.html", index) SubSite = WgetFile("site;sub:.html", site) +LocalSubSite = WgetFile(converted_filename, site) LocalIndexPage = WgetFile("index.html", converted) print(platform.system()) @@ -61,7 +70,7 @@ Files = [[IndexPage, SubSite]] ExpectedReturnCode = 0 -ExpectedDownloadedFiles = [LocalIndexPage, SubSite] +ExpectedDownloadedFiles = [LocalIndexPage, LocalSubSite] ########################### Pre and Post Test Hooks ########################## pre_test = {