qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [5/7] qpid-proton git commit: PROTON-1922: [Python] make tests imports purely relative - Reorder imports to conform to PEP8
Date Tue, 28 Aug 2018 21:39:05 GMT
PROTON-1922: [Python] make tests imports purely relative
- Reorder imports to conform to PEP8


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0642f2bd
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0642f2bd
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0642f2bd

Branch: refs/heads/master
Commit: 0642f2bdf36972c3fd7f54d36d52e4c1bff36b3f
Parents: d4bfe13
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Wed Aug 8 20:08:38 2018 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Tue Aug 28 16:33:06 2018 -0400

----------------------------------------------------------------------
 python/tests/proton-test               |  4 +---
 python/tests/proton_tests/__init__.py  | 26 ++++++++++++++------------
 python/tests/proton_tests/codec.py     | 10 +++++++---
 python/tests/proton_tests/common.py    |  8 ++++++--
 python/tests/proton_tests/engine.py    |  6 +++---
 python/tests/proton_tests/handler.py   |  7 +++----
 python/tests/proton_tests/interop.py   |  6 +++++-
 python/tests/proton_tests/message.py   |  9 ++++++---
 python/tests/proton_tests/reactor.py   |  8 +++++---
 python/tests/proton_tests/sasl.py      |  8 +++++---
 python/tests/proton_tests/soak.py      |  6 ++++--
 python/tests/proton_tests/ssl.py       | 11 +++++------
 python/tests/proton_tests/transport.py |  6 ++++--
 python/tests/proton_tests/url.py       |  5 +++--
 python/tests/proton_tests/utils.py     | 18 +++++++++++-------
 15 files changed, 82 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton-test
----------------------------------------------------------------------
diff --git a/python/tests/proton-test b/python/tests/proton-test
index 6280556..9b3f624 100755
--- a/python/tests/proton-test
+++ b/python/tests/proton-test
@@ -20,12 +20,10 @@
 
 # TODO: summarize, test harness preconditions (e.g. broker is alive)
 
-import logging, optparse, os, struct, sys, time, traceback, types, cgi
+import optparse, os, struct, sys, time, traceback, types, cgi
 from fnmatch import fnmatchcase as match
-from getopt import GetoptError
 from logging import getLogger, StreamHandler, Formatter, Filter, \
     WARN, DEBUG, ERROR
-import unittest
 from proton_tests.common import SkipTest
 
 if sys.version_info[0] == 3:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/__init__.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/__init__.py b/python/tests/proton_tests/__init__.py
index cc75c6c..672a43c 100644
--- a/python/tests/proton_tests/__init__.py
+++ b/python/tests/proton_tests/__init__.py
@@ -17,15 +17,17 @@
 # under the License.
 #
 
-import proton_tests.codec
-import proton_tests.engine
-import proton_tests.message
-import proton_tests.handler
-import proton_tests.reactor
-import proton_tests.sasl
-import proton_tests.transport
-import proton_tests.ssl
-import proton_tests.interop
-import proton_tests.soak
-import proton_tests.url
-import proton_tests.utils
+from __future__ import absolute_import
+
+from . import codec
+from . import engine
+from . import message
+from . import handler
+from . import reactor
+from . import sasl
+from . import transport
+from . import ssl
+from . import interop
+from . import soak
+from . import url
+from . import utils

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/codec.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/codec.py b/python/tests/proton_tests/codec.py
index 43fe09a..e7cade7 100644
--- a/python/tests/proton_tests/codec.py
+++ b/python/tests/proton_tests/codec.py
@@ -17,11 +17,15 @@
 # under the License.
 #
 
-import os, sys
-from . import common
+from __future__ import absolute_import
+
+import sys
+from uuid import uuid4
+
 from proton import *
 from proton._compat import raise_
-from uuid import uuid4
+
+from . import common
 
 class Test(common.Test):
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/common.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/common.py b/python/tests/proton_tests/common.py
index 90ba34c..fd4decc 100644
--- a/python/tests/proton_tests/common.py
+++ b/python/tests/proton_tests/common.py
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+from __future__ import absolute_import
+
 from unittest import TestCase
 try:
   from unittest import SkipTest
@@ -27,15 +29,17 @@ except:
     class SkipTest(Exception):
       pass
 
+import sys, os, subprocess
 from random import randint
 from threading import Thread
 from socket import socket, AF_INET, SOCK_STREAM
 from subprocess import Popen,PIPE,STDOUT
-import sys, os, subprocess
+from string import Template
+
 from proton import SASL, SSL
 from proton.reactor import Container
 from proton.handlers import Handshaker, FlowController
-from string import Template
+
 
 def free_tcp_ports(count=1):
   """ return a list of 'count' TCP ports that are free to used (ie. unbound)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/engine.py b/python/tests/proton_tests/engine.py
index d4f5a5d..3d6353e 100644
--- a/python/tests/proton_tests/engine.py
+++ b/python/tests/proton_tests/engine.py
@@ -16,15 +16,15 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+
 from __future__ import absolute_import
 
 import os, gc
-import sys
-from . import common
 from time import time, sleep
 from proton import *
-from .common import pump, Skipped
 from proton.reactor import Reactor
+from . import common
+from .common import pump, Skipped
 
 
 # older versions of gc do not provide the garbage list

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/handler.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/handler.py b/python/tests/proton_tests/handler.py
index e239bb2..0290d5b 100644
--- a/python/tests/proton_tests/handler.py
+++ b/python/tests/proton_tests/handler.py
@@ -16,16 +16,15 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+
 from __future__ import absolute_import
 
 import os, gc, traceback
-import sys
-from . import common
-from time import time, sleep
+
 from proton import *
-from .common import pump, Skipped
 from proton.reactor import Reactor
 
+from . import common
 
 CUSTOM = EventType("custom")
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/interop.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/interop.py b/python/tests/proton_tests/interop.py
index fe62c02..5ccbd2b 100644
--- a/python/tests/proton_tests/interop.py
+++ b/python/tests/proton_tests/interop.py
@@ -17,9 +17,13 @@
 # under the License.
 #
 
+from __future__ import absolute_import
+
+import os
+
 from proton import *
+
 from . import common
-import os
 
 
 def find_test_interop_dir():

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/message.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/message.py b/python/tests/proton_tests/message.py
index cb8c567..7f6496e 100644
--- a/python/tests/proton_tests/message.py
+++ b/python/tests/proton_tests/message.py
@@ -17,11 +17,14 @@
 # under the License.
 #
 
-import os
-from . import common
-from proton import *
+from __future__ import absolute_import
+
 from uuid import uuid4
 
+from proton import *
+
+from . import common
+
 class Test(common.Test):
 
   def setUp(self):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/reactor.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/reactor.py b/python/tests/proton_tests/reactor.py
index 208baa2..08f914a 100644
--- a/python/tests/proton_tests/reactor.py
+++ b/python/tests/proton_tests/reactor.py
@@ -1,4 +1,3 @@
-from __future__ import absolute_import
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -18,13 +17,16 @@ from __future__ import absolute_import
 # under the License.
 #
 
+from __future__ import absolute_import
+
 import time
-import sys
-from .common import Test, SkipTest, TestServer, free_tcp_port, ensureCanTestExtendedSASL
+
 from proton.reactor import Container, Reactor, ApplicationEvent, EventInjector
 from proton.handlers import Handshaker, MessagingHandler
 from proton import Handler, Url
 
+from .common import Test, SkipTest, TestServer, free_tcp_port, ensureCanTestExtendedSASL
+
 class Barf(Exception):
     pass
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/sasl.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/sasl.py b/python/tests/proton_tests/sasl.py
index 09b5f81..a288536 100644
--- a/python/tests/proton_tests/sasl.py
+++ b/python/tests/proton_tests/sasl.py
@@ -16,13 +16,15 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+
 from __future__ import absolute_import
 
-import sys, os
-from . import common
-from . import engine
+import os
 
 from proton import *
+
+from . import common
+from . import engine
 from .common import pump, Skipped
 
 def _sslCertpath(file):

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/soak.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/soak.py b/python/tests/proton_tests/soak.py
index b7b521c..5e103fd 100644
--- a/python/tests/proton_tests/soak.py
+++ b/python/tests/proton_tests/soak.py
@@ -17,15 +17,17 @@ from __future__ import absolute_import
 # specific language governing permissions and limitations
 # under the License.
 #
+
+from __future__ import absolute_import
+
 import os
-import sys
+
 from .common import Test, Skipped, free_tcp_ports, \
     MessengerReceiverC, MessengerSenderC, \
     MessengerReceiverValgrind, MessengerSenderValgrind, \
     ReactorReceiverC, ReactorSenderC, \
     ReactorReceiverValgrind, ReactorSenderValgrind, \
     isSSLPresent
-from proton import *
 
 #
 # Tests that run the apps

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/ssl.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/ssl.py b/python/tests/proton_tests/ssl.py
index da237f9..fcc3795 100644
--- a/python/tests/proton_tests/ssl.py
+++ b/python/tests/proton_tests/ssl.py
@@ -1,4 +1,3 @@
-from __future__ import absolute_import
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -18,13 +17,13 @@ from __future__ import absolute_import
 # under the License.
 #
 
+from __future__ import absolute_import
+
 import os
-from . import common
-import random
-import string
-import subprocess
-import sys
+
 from proton import *
+
+from . import common
 from .common import Skipped, pump
 
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/transport.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/transport.py b/python/tests/proton_tests/transport.py
index 236169d..78b7f0e 100644
--- a/python/tests/proton_tests/transport.py
+++ b/python/tests/proton_tests/transport.py
@@ -17,11 +17,13 @@
 # under the License.
 #
 
-import os
+from __future__ import absolute_import
+
 import sys
-from . import common
+
 from proton import *
 
+from . import common
 
 class Test(common.Test):
   pass

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/url.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/url.py b/python/tests/proton_tests/url.py
index 2f21a21..7d5c329 100644
--- a/python/tests/proton_tests/url.py
+++ b/python/tests/proton_tests/url.py
@@ -1,4 +1,3 @@
-from __future__ import absolute_import
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -18,10 +17,12 @@ from __future__ import absolute_import
 # under the License.
 #
 
+from __future__ import absolute_import
 
-from . import common
 from proton import Url
 
+from . import common
+
 class UrlTest(common.Test):
     def assertEqual(self, a, b):
         assert a == b, "%s != %s" % (a, b)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0642f2bd/python/tests/proton_tests/utils.py
----------------------------------------------------------------------
diff --git a/python/tests/proton_tests/utils.py b/python/tests/proton_tests/utils.py
index 1f20bba..9c882b4 100644
--- a/python/tests/proton_tests/utils.py
+++ b/python/tests/proton_tests/utils.py
@@ -17,22 +17,26 @@
 # under the License.
 #
 
-import os, time, sys
+from __future__ import absolute_import
+
 from threading import Thread, Event
-from unittest import TestCase
-from proton_tests.common import Test, free_tcp_port
-from copy import copy
-from proton import Message, Url, generate_uuid, Array, UNDESCRIBED, Data, symbol, ConnectionException,
ProtonException
+from uuid import uuid4
+
+from proton import Message, Url, Array, UNDESCRIBED, Data, symbol, ConnectionException
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 from proton.utils import SyncRequestResponse, BlockingConnection
-from .common import Skipped, ensureCanTestExtendedSASL
+
+from .common import Test, free_tcp_port
+from .common import ensureCanTestExtendedSASL
+
 CONNECTION_PROPERTIES={u'connection': u'properties'}
 OFFERED_CAPABILITIES = Array(UNDESCRIBED, Data.SYMBOL, symbol("O_one"), symbol("O_two"),
symbol("O_three"))
 DESIRED_CAPABILITIES = Array(UNDESCRIBED, Data.SYMBOL, symbol("D_one"), symbol("D_two"),
symbol("D_three"))
 ANONYMOUS='ANONYMOUS'
 EXTERNAL='EXTERNAL'
 
+
 class EchoServer(MessagingHandler, Thread):
     """
     Simple echo server that echos messages to their reply-to. Runs in a thread.
@@ -57,7 +61,7 @@ class EchoServer(MessagingHandler, Thread):
     def on_link_opening(self, event):
         if event.link.is_sender:
             if event.link.remote_source and event.link.remote_source.dynamic:
-                event.link.source.address = str(generate_uuid())
+                event.link.source.address = str(uuid4())
                 self.senders[event.link.source.address] = event.link
 
     def on_message(self, event):


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message