summaryrefslogtreecommitdiff
path: root/src/mailman/testing
diff options
context:
space:
mode:
authorBarry Warsaw2014-12-22 20:06:20 -0500
committerBarry Warsaw2014-12-22 20:06:20 -0500
commit286fac3f7c580dfc137ac11290a2ba5713f69472 (patch)
tree1449121ac40dca604016bdef820e32ac08964d39 /src/mailman/testing
parentfdd4748e2bb8da32a737aef3ba4d7705f654c729 (diff)
downloadmailman-286fac3f7c580dfc137ac11290a2ba5713f69472.tar.gz
mailman-286fac3f7c580dfc137ac11290a2ba5713f69472.tar.zst
mailman-286fac3f7c580dfc137ac11290a2ba5713f69472.zip
Remove huge amounts of now unnecessary file boilerplate.
Diffstat (limited to 'src/mailman/testing')
-rw-r--r--src/mailman/testing/documentation.py9
-rw-r--r--src/mailman/testing/helpers.py12
-rw-r--r--src/mailman/testing/i18n.py6
-rw-r--r--src/mailman/testing/layers.py17
-rw-r--r--src/mailman/testing/mta.py6
-rw-r--r--src/mailman/testing/nose.py4
6 files changed, 13 insertions, 41 deletions
diff --git a/src/mailman/testing/documentation.py b/src/mailman/testing/documentation.py
index b8d852fed..e7511fb9b 100644
--- a/src/mailman/testing/documentation.py
+++ b/src/mailman/testing/documentation.py
@@ -21,9 +21,6 @@ Note that doctest extraction does not currently work for zip file
distributions. doctest discovery currently requires file system traversal.
"""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'setup',
'teardown'
@@ -31,7 +28,6 @@ __all__ = [
from inspect import isfunction, ismethod
-
from mailman.app.lifecycle import create_list
from mailman.config import config
from mailman.testing.helpers import call_api, specialized_message_from_string
@@ -145,11 +141,6 @@ def dump_json(url, data=None, method=None, username=None, password=None):
def setup(testobj):
"""Test setup."""
- # Make sure future statements in our doctests are the same as everywhere
- # else.
- testobj.globs['absolute_import'] = absolute_import
- testobj.globs['print_function'] = print_function
- testobj.globs['unicode_literals'] = unicode_literals
# In general, I don't like adding convenience functions, since I think
# doctests should do the imports themselves. It makes for better
# documentation that way. However, a few are really useful, or help to
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py
index 1b8f0d7af..b00534490 100644
--- a/src/mailman/testing/helpers.py
+++ b/src/mailman/testing/helpers.py
@@ -17,9 +17,6 @@
"""Various test helpers."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'LogFileMark',
'TestableMaster',
@@ -60,11 +57,6 @@ from contextlib import contextmanager
from email import message_from_string
from httplib2 import Http
from lazr.config import as_timedelta
-from six.moves.urllib_error import HTTPError
-from six.moves.urllib_parse import urlencode
-from zope import event
-from zope.component import getUtility
-
from mailman.bin.master import Loop as Master
from mailman.config import config
from mailman.database.transaction import transaction
@@ -75,6 +67,10 @@ from mailman.interfaces.styles import IStyleManager
from mailman.interfaces.usermanager import IUserManager
from mailman.runners.digest import DigestRunner
from mailman.utilities.mailbox import Mailbox
+from six.moves.urllib_error import HTTPError
+from six.moves.urllib_parse import urlencode
+from zope import event
+from zope.component import getUtility
NL = '\n'
diff --git a/src/mailman/testing/i18n.py b/src/mailman/testing/i18n.py
index 933a5ec0f..6718f5dda 100644
--- a/src/mailman/testing/i18n.py
+++ b/src/mailman/testing/i18n.py
@@ -17,9 +17,6 @@
"""Internationalization for the tests."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'TestingStrategy',
'initialize',
@@ -29,9 +26,8 @@ __all__ = [
from contextlib import closing
from flufl.i18n import registry
from gettext import GNUTranslations, NullTranslations
-from pkg_resources import resource_stream
-
from mailman.core.i18n import initialize as core_initialize
+from pkg_resources import resource_stream
diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py
index 8ec6c307f..d38878160 100644
--- a/src/mailman/testing/layers.py
+++ b/src/mailman/testing/layers.py
@@ -20,14 +20,10 @@
# XXX 2012-03-23 BAW: Layers really really suck. For example, the
# test_owners_get_email() test requires that both the SMTPLayer and LMTPLayer
# be set up, but there's apparently no way to do that and make zope.testing
-# happy. This causes no tests failures, but it does cause errors at the end
-# of the full test run. For now, I'll ignore that, but I do want to
-# eventually get rid of the zope.test* dependencies and use something like
-# testresources or some such.
+# happy. This causes no test failures, but it does cause errors at the end of
+# the full test run. For now, I'll ignore that, but I do want to eventually
+# get rid of the layers and use something like testresources or some such.
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'ConfigLayer',
'LMTPLayer',
@@ -46,10 +42,6 @@ import datetime
import tempfile
from lazr.config import as_boolean
-from pkg_resources import resource_string as resource_bytes
-from textwrap import dedent
-from zope.component import getUtility
-
from mailman.config import config
from mailman.core import initialize
from mailman.core.initialize import INHIBIT_CONFIG_FILE
@@ -60,6 +52,9 @@ from mailman.testing.helpers import (
TestableMaster, get_lmtp_client, reset_the_world, wait_for_webservice)
from mailman.testing.mta import ConnectionCountingController
from mailman.utilities.string import expand
+from pkg_resources import resource_string as resource_bytes
+from textwrap import dedent
+from zope.component import getUtility
TEST_TIMEOUT = datetime.timedelta(seconds=5)
diff --git a/src/mailman/testing/mta.py b/src/mailman/testing/mta.py
index 4dd5bc097..81a6bf1ac 100644
--- a/src/mailman/testing/mta.py
+++ b/src/mailman/testing/mta.py
@@ -17,9 +17,6 @@
"""Fake MTA for testing purposes."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'FakeMTA',
]
@@ -29,11 +26,10 @@ import logging
from lazr.smtptest.controller import QueueController
from lazr.smtptest.server import Channel, QueueServer
+from mailman.interfaces.mta import IMailTransportAgentLifecycle
from six.moves.queue import Empty, Queue
from zope.interface import implementer
-from mailman.interfaces.mta import IMailTransportAgentLifecycle
-
log = logging.getLogger('lazr.smtptest')
diff --git a/src/mailman/testing/nose.py b/src/mailman/testing/nose.py
index 8d175873c..181048b64 100644
--- a/src/mailman/testing/nose.py
+++ b/src/mailman/testing/nose.py
@@ -17,9 +17,6 @@
"""nose2 test infrastructure."""
-from __future__ import absolute_import, print_function, unicode_literals
-
-__metaclass__ = type
__all__ = [
'NosePlugin',
]
@@ -35,6 +32,7 @@ from mailman.testing.documentation import setup, teardown
from mailman.testing.layers import ConfigLayer, MockAndMonkeyLayer, SMTPLayer
from nose2.events import Plugin
+
DOT = '.'
FLAGS = doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF
TOPDIR = os.path.dirname(mailman.__file__)