From 18dde97c8cd377bbd2a1c9af816005b4ae473832 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Caruana Date: Fri, 26 Jul 2013 13:02:26 +0200 Subject: [PATCH] refactor: no import * in tests --- tests/test_events.py | 3 ++- tests/test_jid.py | 3 ++- tests/test_stanza_base.py | 3 ++- tests/test_stanza_element.py | 5 +++-- tests/test_stanza_error.py | 3 ++- tests/test_stanza_gmail.py | 5 ++++- tests/test_stanza_iq.py | 3 ++- tests/test_stanza_message.py | 4 +++- tests/test_stanza_presence.py | 6 +++--- tests/test_stanza_roster.py | 5 +++-- tests/test_stanza_xep_0004.py | 5 ++++- tests/test_stanza_xep_0030.py | 5 ++++- tests/test_stanza_xep_0033.py | 5 ++++- tests/test_stanza_xep_0047.py | 6 +++++- tests/test_stanza_xep_0050.py | 4 +++- tests/test_stanza_xep_0059.py | 4 +++- tests/test_stanza_xep_0060.py | 4 +++- tests/test_stanza_xep_0085.py | 6 +++++- tests/test_stanza_xep_0184.py | 5 ++++- tests/test_stream.py | 3 ++- tests/test_stream_exceptions.py | 5 ++--- tests/test_stream_filters.py | 7 +++---- tests/test_stream_handlers.py | 8 ++++---- tests/test_stream_presence.py | 3 ++- tests/test_stream_roster.py | 5 +++-- tests/test_stream_xep_0030.py | 4 ++-- tests/test_stream_xep_0047.py | 3 ++- tests/test_stream_xep_0050.py | 7 ++++--- tests/test_stream_xep_0059.py | 3 ++- tests/test_stream_xep_0060.py | 5 ++--- tests/test_stream_xep_0066.py | 4 ++-- tests/test_stream_xep_0085.py | 4 ++-- tests/test_stream_xep_0092.py | 3 ++- tests/test_stream_xep_0128.py | 8 ++------ tests/test_stream_xep_0249.py | 6 ++---- tests/test_tostring.py | 6 +++--- 36 files changed, 102 insertions(+), 66 deletions(-) diff --git a/tests/test_events.py b/tests/test_events.py index fb34be30..a41ed017 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -1,5 +1,6 @@ import time -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestEvents(SleekTest): diff --git a/tests/test_jid.py b/tests/test_jid.py index 76e56586..ed2aeea9 100644 --- a/tests/test_jid.py +++ b/tests/test_jid.py @@ -1,6 +1,7 @@ # -*- encoding: utf8 -*- from __future__ import unicode_literals -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp import JID, InvalidJID from sleekxmpp.jid import nodeprep diff --git a/tests/test_stanza_base.py b/tests/test_stanza_base.py index 9bd326b6..deb7ab96 100644 --- a/tests/test_stanza_base.py +++ b/tests/test_stanza_base.py @@ -1,4 +1,5 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp.xmlstream.stanzabase import ET, StanzaBase diff --git a/tests/test_stanza_element.py b/tests/test_stanza_element.py index b7ccdb87..2b9676cf 100644 --- a/tests/test_stanza_element.py +++ b/tests/test_stanza_element.py @@ -1,5 +1,6 @@ -from sleekxmpp.test import * -from sleekxmpp.xmlstream.stanzabase import ElementBase +import unittest +from sleekxmpp.test import SleekTest +from sleekxmpp.xmlstream.stanzabase import ElementBase, register_stanza_plugin, ET from sleekxmpp.thirdparty import OrderedDict diff --git a/tests/test_stanza_error.py b/tests/test_stanza_error.py index a41bf4bf..d95a33ce 100644 --- a/tests/test_stanza_error.py +++ b/tests/test_stanza_error.py @@ -1,4 +1,5 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestErrorStanzas(SleekTest): diff --git a/tests/test_stanza_gmail.py b/tests/test_stanza_gmail.py index 6190c608..a15fea20 100644 --- a/tests/test_stanza_gmail.py +++ b/tests/test_stanza_gmail.py @@ -1,5 +1,8 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp import Iq +from sleekxmpp.test import SleekTest import sleekxmpp.plugins.gmail_notify as gmail +from sleekxmpp.xmlstream import register_stanza_plugin, ET class TestGmail(SleekTest): diff --git a/tests/test_stanza_iq.py b/tests/test_stanza_iq.py index 42e4dcde..0f5e30b0 100644 --- a/tests/test_stanza_iq.py +++ b/tests/test_stanza_iq.py @@ -1,4 +1,5 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp.xmlstream.stanzabase import ET diff --git a/tests/test_stanza_message.py b/tests/test_stanza_message.py index 3ed965b6..9968a630 100644 --- a/tests/test_stanza_message.py +++ b/tests/test_stanza_message.py @@ -1,6 +1,8 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp.stanza.message import Message from sleekxmpp.stanza.htmlim import HTMLIM +from sleekxmpp.xmlstream import register_stanza_plugin class TestMessageStanzas(SleekTest): diff --git a/tests/test_stanza_presence.py b/tests/test_stanza_presence.py index 2ec43b65..184dce96 100644 --- a/tests/test_stanza_presence.py +++ b/tests/test_stanza_presence.py @@ -1,6 +1,6 @@ -from sleekxmpp.test import * -from sleekxmpp.stanza.presence import Presence - +import unittest +import sleekxmpp +from sleekxmpp.test import SleekTest class TestPresenceStanzas(SleekTest): diff --git a/tests/test_stanza_roster.py b/tests/test_stanza_roster.py index 8ec2d32b..d121568b 100644 --- a/tests/test_stanza_roster.py +++ b/tests/test_stanza_roster.py @@ -1,5 +1,6 @@ -from sleekxmpp.test import * -from sleekxmpp.stanza.roster import Roster +import unittest +from sleekxmpp.test import SleekTest +from sleekxmpp.xmlstream import ET class TestRosterStanzas(SleekTest): diff --git a/tests/test_stanza_xep_0004.py b/tests/test_stanza_xep_0004.py index e183e5e9..9056c663 100644 --- a/tests/test_stanza_xep_0004.py +++ b/tests/test_stanza_xep_0004.py @@ -1,7 +1,10 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp import Message +from sleekxmpp.test import SleekTest from sleekxmpp.thirdparty import OrderedDict import sleekxmpp.plugins.xep_0004 as xep_0004 +from sleekxmpp.xmlstream import register_stanza_plugin class TestDataForms(SleekTest): diff --git a/tests/test_stanza_xep_0030.py b/tests/test_stanza_xep_0030.py index 2d64988d..986c1880 100644 --- a/tests/test_stanza_xep_0030.py +++ b/tests/test_stanza_xep_0030.py @@ -1,5 +1,8 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp import Iq +from sleekxmpp.test import SleekTest import sleekxmpp.plugins.xep_0030 as xep_0030 +from sleekxmpp.xmlstream import register_stanza_plugin class TestDisco(SleekTest): diff --git a/tests/test_stanza_xep_0033.py b/tests/test_stanza_xep_0033.py index ec9a5309..bf10cf6c 100644 --- a/tests/test_stanza_xep_0033.py +++ b/tests/test_stanza_xep_0033.py @@ -1,5 +1,8 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp import Message +from sleekxmpp.test import SleekTest import sleekxmpp.plugins.xep_0033 as xep_0033 +from sleekxmpp.xmlstream import register_stanza_plugin class TestAddresses(SleekTest): diff --git a/tests/test_stanza_xep_0047.py b/tests/test_stanza_xep_0047.py index 6aa2314b..9fd3c4d6 100644 --- a/tests/test_stanza_xep_0047.py +++ b/tests/test_stanza_xep_0047.py @@ -1,5 +1,9 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp.exceptions import XMPPError +from sleekxmpp import Iq +from sleekxmpp.test import SleekTest from sleekxmpp.plugins.xep_0047 import Data +from sleekxmpp.xmlstream import register_stanza_plugin, ET class TestIBB(SleekTest): diff --git a/tests/test_stanza_xep_0050.py b/tests/test_stanza_xep_0050.py index e02e86c3..9d49b3ee 100644 --- a/tests/test_stanza_xep_0050.py +++ b/tests/test_stanza_xep_0050.py @@ -1,6 +1,8 @@ from sleekxmpp import Iq -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp.plugins.xep_0050 import Command +from sleekxmpp.xmlstream import register_stanza_plugin class TestAdHocCommandStanzas(SleekTest): diff --git a/tests/test_stanza_xep_0059.py b/tests/test_stanza_xep_0059.py index 913436a6..860ec869 100644 --- a/tests/test_stanza_xep_0059.py +++ b/tests/test_stanza_xep_0059.py @@ -1,5 +1,7 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp.plugins.xep_0059 import Set +from sleekxmpp.xmlstream import ET class TestSetStanzas(SleekTest): diff --git a/tests/test_stanza_xep_0060.py b/tests/test_stanza_xep_0060.py index 3898d0ab..332b53ea 100644 --- a/tests/test_stanza_xep_0060.py +++ b/tests/test_stanza_xep_0060.py @@ -1,6 +1,8 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest import sleekxmpp.plugins.xep_0004 as xep_0004 import sleekxmpp.plugins.xep_0060.stanza as pubsub +from sleekxmpp.xmlstream.stanzabase import ET class TestPubsubStanzas(SleekTest): diff --git a/tests/test_stanza_xep_0085.py b/tests/test_stanza_xep_0085.py index 61784e47..303e6c5b 100644 --- a/tests/test_stanza_xep_0085.py +++ b/tests/test_stanza_xep_0085.py @@ -1,5 +1,9 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp import Message +from sleekxmpp.test import SleekTest import sleekxmpp.plugins.xep_0085 as xep_0085 +from sleekxmpp.xmlstream import register_stanza_plugin + class TestChatStates(SleekTest): diff --git a/tests/test_stanza_xep_0184.py b/tests/test_stanza_xep_0184.py index 13472373..0c340487 100644 --- a/tests/test_stanza_xep_0184.py +++ b/tests/test_stanza_xep_0184.py @@ -1,5 +1,8 @@ -from sleekxmpp.test import * +import unittest +from sleekxmpp import Message +from sleekxmpp.test import SleekTest import sleekxmpp.plugins.xep_0184 as xep_0184 +from sleekxmpp.xmlstream import register_stanza_plugin class TestReciept(SleekTest): diff --git a/tests/test_stream.py b/tests/test_stream.py index deac24a5..f68f8426 100644 --- a/tests/test_stream.py +++ b/tests/test_stream.py @@ -1,5 +1,6 @@ import time -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestStreamTester(SleekTest): diff --git a/tests/test_stream_exceptions.py b/tests/test_stream_exceptions.py index c41edbb2..d18d059a 100644 --- a/tests/test_stream_exceptions.py +++ b/tests/test_stream_exceptions.py @@ -1,9 +1,8 @@ -import sys -import sleekxmpp from sleekxmpp.xmlstream.matcher import MatchXPath from sleekxmpp.xmlstream.handler import Callback from sleekxmpp.exceptions import XMPPError -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestStreamExceptions(SleekTest): diff --git a/tests/test_stream_filters.py b/tests/test_stream_filters.py index ef4d5dc8..ee17ffdc 100644 --- a/tests/test_stream_filters.py +++ b/tests/test_stream_filters.py @@ -1,9 +1,8 @@ import time from sleekxmpp import Message -from sleekxmpp.test import * -from sleekxmpp.xmlstream.handler import * -from sleekxmpp.xmlstream.matcher import * +import unittest +from sleekxmpp.test import SleekTest class TestFilters(SleekTest): @@ -84,5 +83,5 @@ class TestFilters(SleekTest): """) - + suite = unittest.TestLoader().loadTestsFromTestCase(TestFilters) diff --git a/tests/test_stream_handlers.py b/tests/test_stream_handlers.py index 183e4bf9..ef46da6a 100644 --- a/tests/test_stream_handlers.py +++ b/tests/test_stream_handlers.py @@ -1,9 +1,9 @@ import time -from sleekxmpp import Message -from sleekxmpp.test import * -from sleekxmpp.xmlstream.handler import * -from sleekxmpp.xmlstream.matcher import * +import unittest +from sleekxmpp.test import SleekTest +from sleekxmpp.exceptions import IqTimeout +from sleekxmpp import Callback, MatchXPath class TestHandlers(SleekTest): diff --git a/tests/test_stream_presence.py b/tests/test_stream_presence.py index 4f2ede16..365a09ed 100644 --- a/tests/test_stream_presence.py +++ b/tests/test_stream_presence.py @@ -1,5 +1,6 @@ import time -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestStreamPresence(SleekTest): diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py index fa87105e..221954ab 100644 --- a/tests/test_stream_roster.py +++ b/tests/test_stream_roster.py @@ -1,8 +1,9 @@ # -*- encoding:utf-8 -*- - from __future__ import unicode_literals -from sleekxmpp.test import * +import unittest +from sleekxmpp.exceptions import IqTimeout +from sleekxmpp.test import SleekTest import time import threading diff --git a/tests/test_stream_xep_0030.py b/tests/test_stream_xep_0030.py index dd43778a..37d29d33 100644 --- a/tests/test_stream_xep_0030.py +++ b/tests/test_stream_xep_0030.py @@ -1,8 +1,8 @@ -import sys import time import threading -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestStreamDisco(SleekTest): diff --git a/tests/test_stream_xep_0047.py b/tests/test_stream_xep_0047.py index 8c46606e..0515bca5 100644 --- a/tests/test_stream_xep_0047.py +++ b/tests/test_stream_xep_0047.py @@ -1,7 +1,8 @@ import threading import time -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestInBandByteStreams(SleekTest): diff --git a/tests/test_stream_xep_0050.py b/tests/test_stream_xep_0050.py index 5ad9d6ae..261a0057 100644 --- a/tests/test_stream_xep_0050.py +++ b/tests/test_stream_xep_0050.py @@ -1,8 +1,9 @@ import time import logging -import threading -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest +from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin class TestAdHocCommands(SleekTest): @@ -35,7 +36,7 @@ class TestAdHocCommands(SleekTest): logging.debug(initial) new_payload = TestPayload() if initial: - new_payload['bar'] = 'Received: %s' % initial['bar'] + new_payload['bar'] = 'Received: %s' % initial['bar'] else: new_payload['bar'] = 'Failed' diff --git a/tests/test_stream_xep_0059.py b/tests/test_stream_xep_0059.py index 249ecf66..5f3ea079 100644 --- a/tests/test_stream_xep_0059.py +++ b/tests/test_stream_xep_0059.py @@ -1,6 +1,7 @@ import threading -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp.xmlstream import register_stanza_plugin from sleekxmpp.plugins.xep_0030 import DiscoItems from sleekxmpp.plugins.xep_0059 import ResultIterator, Set diff --git a/tests/test_stream_xep_0060.py b/tests/test_stream_xep_0060.py index 0ad14b02..581d5d00 100644 --- a/tests/test_stream_xep_0060.py +++ b/tests/test_stream_xep_0060.py @@ -1,8 +1,7 @@ -import sys -import time import threading -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest from sleekxmpp.stanza.atom import AtomEntry from sleekxmpp.xmlstream import register_stanza_plugin diff --git a/tests/test_stream_xep_0066.py b/tests/test_stream_xep_0066.py index e3f2ddfa..175026d2 100644 --- a/tests/test_stream_xep_0066.py +++ b/tests/test_stream_xep_0066.py @@ -1,7 +1,7 @@ -import time import threading -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestOOB(SleekTest): diff --git a/tests/test_stream_xep_0085.py b/tests/test_stream_xep_0085.py index 2a814805..54e7e15f 100644 --- a/tests/test_stream_xep_0085.py +++ b/tests/test_stream_xep_0085.py @@ -1,7 +1,7 @@ -import threading import time -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestStreamChatStates(SleekTest): diff --git a/tests/test_stream_xep_0092.py b/tests/test_stream_xep_0092.py index a3960fa2..c0748697 100644 --- a/tests/test_stream_xep_0092.py +++ b/tests/test_stream_xep_0092.py @@ -1,6 +1,7 @@ import threading -from sleekxmpp.test import * +import unittest +from sleekxmpp.test import SleekTest class TestStreamSet(SleekTest): diff --git a/tests/test_stream_xep_0128.py b/tests/test_stream_xep_0128.py index 42fc9143..10222d9b 100644 --- a/tests/test_stream_xep_0128.py +++ b/tests/test_stream_xep_0128.py @@ -1,9 +1,5 @@ -import sys -import time -import threading - -from sleekxmpp.test import * -from sleekxmpp.xmlstream import ElementBase +import unittest +from sleekxmpp.test import SleekTest class TestStreamExtendedDisco(SleekTest): diff --git a/tests/test_stream_xep_0249.py b/tests/test_stream_xep_0249.py index 9a25253f..8edea270 100644 --- a/tests/test_stream_xep_0249.py +++ b/tests/test_stream_xep_0249.py @@ -1,9 +1,7 @@ -import sys import time -import threading -from sleekxmpp.test import * -from sleekxmpp.xmlstream import ElementBase +import unittest +from sleekxmpp.test import SleekTest class TestStreamDirectInvite(SleekTest): diff --git a/tests/test_tostring.py b/tests/test_tostring.py index 8c04f00c..e6148533 100644 --- a/tests/test_tostring.py +++ b/tests/test_tostring.py @@ -1,6 +1,6 @@ -from sleekxmpp.test import * -from sleekxmpp.stanza import Message -from sleekxmpp.xmlstream.stanzabase import ET, ElementBase +import unittest +from sleekxmpp.test import SleekTest +from sleekxmpp.xmlstream.stanzabase import ET from sleekxmpp.xmlstream.tostring import tostring, escape