From fe22ebdb98d125db840c980cbd953a8fbc2e5cdf Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Tue, 29 Nov 2016 18:51:05 -0500 Subject: Use `atpublic` for @public instead of internal copy. --- src/mailman/testing/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mailman/testing/helpers.py') diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py index 2ce6956b7..01b362192 100644 --- a/src/mailman/testing/helpers.py +++ b/src/mailman/testing/helpers.py @@ -35,7 +35,6 @@ from contextlib import contextmanager, suppress from email import message_from_string from httplib2 import Http from lazr.config import as_timedelta -from mailman import public from mailman.bin.master import Loop as Master from mailman.config import config from mailman.database.transaction import transaction @@ -46,6 +45,7 @@ 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 public import public from unittest import mock from urllib.error import HTTPError from urllib.parse import urlencode -- cgit v1.2.3-70-g09d2 From b0f5e43046c6b4be473e1d98623e3157221719af Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 30 Nov 2016 15:03:35 -0500 Subject: Finish configuring flufl.testing. Also, use the better way to set the LMTP ident. --- src/mailman/runners/lmtp.py | 7 +++---- src/mailman/testing/helpers.py | 8 ++++++++ unittest.cfg | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src/mailman/testing/helpers.py') diff --git a/src/mailman/runners/lmtp.py b/src/mailman/runners/lmtp.py index 0fa13a611..b0f473c0b 100644 --- a/src/mailman/runners/lmtp.py +++ b/src/mailman/runners/lmtp.py @@ -93,9 +93,6 @@ ERR_502 = '502 Error: command HELO not implemented' ERR_550 = '550 Requested action not taken: mailbox unavailable' ERR_550_MID = '550 No Message-ID header provided' -# XXX Blech -aiosmtpd.smtp.__version__ = 'GNU Mailman LMTP runner 2.0' - def split_recipient(address): """Split an address into listname, subaddress and domain parts. @@ -218,7 +215,9 @@ class LMTPHandler: class LMTPController(Controller): def factory(self): - return LMTP(self.handler) + server = LMTP(self.handler) + server.__ident__ = 'GNU Mailman LMTP runner 2.0' + return server def make_socket(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py index 01b362192..233b03cf8 100644 --- a/src/mailman/testing/helpers.py +++ b/src/mailman/testing/helpers.py @@ -568,3 +568,11 @@ def hackenv(envar, new_value): del os.environ[envar] else: os.environ[envar] = old_value + + +def nose2_start_test_run_callback(plugin): + from mailman.testing.layers import ConfigLayer, MockAndMonkeyLayer + MockAndMonkeyLayer.testing_mode = True + if (plugin.stderr or + len(os.environ.get('MM_VERBOSE_TESTLOG', '').strip()) > 0): + ConfigLayer.stderr = True diff --git a/unittest.cfg b/unittest.cfg index 9fc0912a9..ba479fdf8 100644 --- a/unittest.cfg +++ b/unittest.cfg @@ -9,3 +9,7 @@ always-on = False [flufl.testing] always-on = True package = mailman +start_run = mailman.testing.helpers.nose2_start_test_run_callback +default_layer = mailman.testing.layers.SMTPLayer +setup = mailman.testing.documentation.setup +teardown = mailman.testing.documentation.teardown -- cgit v1.2.3-70-g09d2