Subject: bug#70722: closed (Re: bug#70722: [PATCH] ; Migrate to python3 for (package-test-update-archives-async))

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 11 May 2024 10:09:02 +0000

Your bug report

#70722: [PATCH] ; Migrate to python3 for (package-test-update-archives-async)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
70722: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70722
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#70722: [PATCH] ; Migrate to python3 for (package-test-update-archives-async)
From: Eli Zaretskii <[email-masked]>
To: kobarity <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sat, 11 May 2024 13:07:58 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Fri, 10 May 2024 01:00:13 +0900
> From: kobarity <[email-masked]>
> Cc: [email-masked]
> 
> > kobarity, any comments, or should I install this?
> 
> I agree with the policy to support both Python 2/3.
> How about a patch like the one attached?

Thanks, installed on the master branch, and closing the bug.

Subject: [PATCH] ; Migrate to python3 for (package-test-update-archives-async)
From: Lin Sun <[email-masked]>
To: [email-masked]
Date: Thu, 2 May 2024 18:11:04 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,
The test case "package-test-update-archives-async" still tries to
search "python2" for testing, while python2 was at the end of its life
years ago.
So move the test case from python2 to python3.
Please help review the patch. Thanks
From fc41f0c78601f9ca92ce5be4572a2d9b38822d28 Mon Sep 17 00:00:00 2001
From: Lin Sun <[email-masked]>
Date: Thu, 2 May 2024 06:52:09 +0000
Subject: [PATCH] ; Migrate to python3 for (package-test-update-archives-async)

* package-test-update-archives-async (package-test-update-archives-async):
  Try search python3 or python instead of pyhton2.
* test/lisp/emacs-lisp/package-resources/package-test-server.py:
  Rewrite script with python3.
---
 .../package-resources/package-test-server.py   | 18 +++++-------------
 test/lisp/emacs-lisp/package-tests.el          | 10 ++++++----
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/test/lisp/emacs-lisp/package-resources/package-test-server.py b/test/lisp/emacs-lisp/package-resources/package-test-server.py
index 128b4249ec3..2b915823aa2 100644
--- a/test/lisp/emacs-lisp/package-resources/package-test-server.py
+++ b/test/lisp/emacs-lisp/package-resources/package-test-server.py
@@ -1,20 +1,12 @@
 import sys
-import BaseHTTPServer
-from SimpleHTTPServer import SimpleHTTPRequestHandler
+from http.server import HTTPServer, SimpleHTTPRequestHandler

-HandlerClass = SimpleHTTPRequestHandler
-ServerClass  = BaseHTTPServer.HTTPServer
-Protocol     = "HTTP/1.0"
-
-if sys.argv[1:]:
-    port = int(sys.argv[1])
-else:
-    port = 0
-server_address = ('127.0.0.1', port)
 
-HandlerClass.protocol_version = Protocol
-httpd = ServerClass(server_address, HandlerClass)
+HandlerClass = SimpleHTTPRequestHandler
+HandlerClass.protocol_version = "HTTP/1.0"
+server_address = ('127.0.0.1', int(sys.argv[1]) if sys.argv[1:] else 0)
+httpd = HTTPServer(server_address, HandlerClass)
 
 ip, port = httpd.socket.getsockname()[0:2]
 print ("Server started, http://%s:%s/" % (ip, port))
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index d95b94f2145..f2cce5ae8dc 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -634,14 +634,16 @@ package-test-update-archives
 (ert-deftest package-test-update-archives-async ()
   "Test updating package archives asynchronously."
   :tags '(:expensive-test)
-  (skip-unless (executable-find "python2"))
   (let* ((package-menu-async t)
          (default-directory package-test-data-dir)
-         (process (start-process
+         (python-interpreter (cl-some #'executable-find '("python3" "python")))
+         process
+         addr)
+    (skip-unless python-interpreter)
+    (setq process (start-process
                    "package-server" "package-server-buffer"
-                   (executable-find "python2")
+                   python-interpreter
                    "package-test-server.py"))
-         (addr nil))
     (unwind-protect
         (progn
           (with-current-buffer "package-server-buffer"
-- 
2.20.5