Patchwork [8,of,8] tests/tinyproxy: use absolute_import

login
register
mail settings
Submitter Gregory Szorc
Date Dec. 8, 2015, 3:35 a.m.
Message ID <e90d5745a1358e7da42c.1449545708@gps-mbp.local>
Download mbox | patch
Permalink /patch/11922/
State Accepted
Headers show

Comments

Gregory Szorc - Dec. 8, 2015, 3:35 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1449469208 28800
#      Sun Dec 06 22:20:08 2015 -0800
# Node ID e90d5745a1358e7da42c934cf0a840df1901699f
# Parent  4bd8525de68c587b1385da318370e61b310bc3e1
tests/tinyproxy: use absolute_import

Thus begins a series of adding absolute_import to a bunch of files for
Python 3 compatibility.
Sean Farley - Dec. 8, 2015, 5:02 a.m.
Gregory Szorc <gregory.szorc@gmail.com> writes:

> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1449469208 28800
> #      Sun Dec 06 22:20:08 2015 -0800
> # Node ID e90d5745a1358e7da42c934cf0a840df1901699f
> # Parent  4bd8525de68c587b1385da318370e61b310bc3e1
> tests/tinyproxy: use absolute_import

Very minor nit: the whole 'tests/' prefix is a bit verbose IMHO.
Dropping that on all these patches would not take anything away from the
message of the commit subject and save on what little space I have on
reading. Not really a big deal, though.
Augie Fackler - Dec. 8, 2015, 3:43 p.m.
On Mon, Dec 07, 2015 at 10:35:08PM -0500, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1449469208 28800
> #      Sun Dec 06 22:20:08 2015 -0800
> # Node ID e90d5745a1358e7da42c934cf0a840df1901699f
> # Parent  4bd8525de68c587b1385da318370e61b310bc3e1
> tests/tinyproxy: use absolute_import

Queued these, thanks.

>
> Thus begins a series of adding absolute_import to a bunch of files for
> Python 3 compatibility.
>
> diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
> --- a/tests/test-check-py3-compat.t
> +++ b/tests/test-check-py3-compat.t
> @@ -219,6 +219,5 @@
>    tests/test-url.py not using absolute_import
>    tests/test-url.py requires print_function
>    tests/test-walkrepo.py requires print_function
>    tests/test-wireproto.py requires print_function
> -  tests/tinyproxy.py not using absolute_import
>    tests/tinyproxy.py requires print_function
> diff --git a/tests/tinyproxy.py b/tests/tinyproxy.py
> --- a/tests/tinyproxy.py
> +++ b/tests/tinyproxy.py
> @@ -1,6 +1,8 @@
>  #!/usr/bin/env python
>
> +from __future__ import absolute_import
> +
>  __doc__ = """Tiny HTTP Proxy.
>
>  This module implements GET, HEAD, POST, PUT and DELETE methods
>  on BaseHTTPServer, and behaves as an HTTP proxy.  The CONNECT
> @@ -11,9 +13,14 @@ Any help will be greatly appreciated.
>  """
>
>  __version__ = "0.2.1"
>
> -import BaseHTTPServer, select, socket, SocketServer, urlparse, os
> +import BaseHTTPServer
> +import os
> +import select
> +import socket
> +import SocketServer
> +import urlparse
>
>  class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
>      __base = BaseHTTPServer.BaseHTTPRequestHandler
>      __base_handle = __base.handle
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -219,6 +219,5 @@ 
   tests/test-url.py not using absolute_import
   tests/test-url.py requires print_function
   tests/test-walkrepo.py requires print_function
   tests/test-wireproto.py requires print_function
-  tests/tinyproxy.py not using absolute_import
   tests/tinyproxy.py requires print_function
diff --git a/tests/tinyproxy.py b/tests/tinyproxy.py
--- a/tests/tinyproxy.py
+++ b/tests/tinyproxy.py
@@ -1,6 +1,8 @@ 
 #!/usr/bin/env python
 
+from __future__ import absolute_import
+
 __doc__ = """Tiny HTTP Proxy.
 
 This module implements GET, HEAD, POST, PUT and DELETE methods
 on BaseHTTPServer, and behaves as an HTTP proxy.  The CONNECT
@@ -11,9 +13,14 @@  Any help will be greatly appreciated.   
 """
 
 __version__ = "0.2.1"
 
-import BaseHTTPServer, select, socket, SocketServer, urlparse, os
+import BaseHTTPServer
+import os
+import select
+import socket
+import SocketServer
+import urlparse
 
 class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler):
     __base = BaseHTTPServer.BaseHTTPRequestHandler
     __base_handle = __base.handle