all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lin Sun <sunlin7.mail@gmail.com>
To: 70722@debbugs.gnu.org
Subject: bug#70722: [PATCH] ; Migrate to python3 for (package-test-update-archives-async)
Date: Thu, 2 May 2024 18:11:04 +0000	[thread overview]
Message-ID: <CABCREdpF1c5AK5mZqvdEhvVHK4XVCDqjcRJ8VHxj_Qrhw-u+AQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

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

[-- Attachment #2: 0001-Migrate-to-python3-for-package-test-update-archives-.patch --]
[-- Type: text/x-patch, Size: 2820 bytes --]

From fc41f0c78601f9ca92ce5be4572a2d9b38822d28 Mon Sep 17 00:00:00 2001
From: Lin Sun <sunlin7@hotmail.com>
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


             reply	other threads:[~2024-05-02 18:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 18:11 Lin Sun [this message]
2024-05-02 18:54 ` bug#70722: [PATCH] ; Migrate to python3 for (package-test-update-archives-async) Eli Zaretskii
2024-05-06  0:28   ` Lin Sun
2024-05-09  8:33     ` Eli Zaretskii
2024-05-09 16:00       ` kobarity
2024-05-09 16:19         ` Lin Sun
2024-05-11 10:07         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABCREdpF1c5AK5mZqvdEhvVHK4XVCDqjcRJ8VHxj_Qrhw-u+AQ@mail.gmail.com \
    --to=sunlin7.mail@gmail.com \
    --cc=70722@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.