launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27339
[Merge] ~cjwatson/launchpad:doctest-remove-future into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:doctest-remove-future into launchpad:master.
Commit message:
Remove future=True from doctest/pagetest setup
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406605
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:doctest-remove-future into launchpad:master.
diff --git a/lib/lp/answers/browser/tests/test_views.py b/lib/lp/answers/browser/tests/test_views.py
index c7affee..54749e3 100644
--- a/lib/lp/answers/browser/tests/test_views.py
+++ b/lib/lp/answers/browser/tests/test_views.py
@@ -50,15 +50,12 @@ def test_suite():
loader = unittest.TestLoader()
suite.addTest(loader.loadTestsFromTestCase(TestEmailObfuscated))
suite.addTest(LayeredDocFileSuite(
- 'question-subscribe_me.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ 'question-subscribe_me.txt', setUp=setUp, tearDown=tearDown,
layer=DatabaseFunctionalLayer))
suite.addTest(LayeredDocFileSuite(
- 'views.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ 'views.txt', setUp=setUp, tearDown=tearDown,
layer=DatabaseFunctionalLayer))
suite.addTest(LayeredDocFileSuite(
- 'faq-views.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ 'faq-views.txt', setUp=setUp, tearDown=tearDown,
layer=DatabaseFunctionalLayer))
return suite
diff --git a/lib/lp/answers/tests/test_doc.py b/lib/lp/answers/tests/test_doc.py
index 5f7083d..9217d7e 100644
--- a/lib/lp/answers/tests/test_doc.py
+++ b/lib/lp/answers/tests/test_doc.py
@@ -20,7 +20,6 @@ from lp.testing import (
login,
)
from lp.testing.layers import DatabaseFunctionalLayer
-from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setUp,
@@ -33,7 +32,7 @@ here = os.path.dirname(os.path.realpath(__file__))
def productSetUp(test):
"""Test environment for product."""
- setUp(test, future=True)
+ setUp(test)
thunderbird = getUtility(IProductSet).getByName('thunderbird')
test.globs['target'] = thunderbird
test.globs['collection'] = thunderbird
@@ -44,7 +43,7 @@ def productSetUp(test):
def distributionSetUp(test):
"""Test environment for distribution."""
- setUp(test, future=True)
+ setUp(test)
kubuntu = getUtility(IDistributionSet).getByName('kubuntu')
test.globs['target'] = kubuntu
test.globs['collection'] = kubuntu
@@ -55,7 +54,7 @@ def distributionSetUp(test):
def projectSetUp(test):
"""Test environment for project."""
- setUp(test, future=True)
+ setUp(test)
gnome_project = getUtility(IProjectGroupSet).getByName('gnome')
products_queue = list(gnome_project.products)
@@ -72,7 +71,7 @@ def projectSetUp(test):
def distributionsourcepackageSetUp(test):
- setUp(test, future=True)
+ setUp(test)
ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
test.globs['target'] = ubuntu.getSourcePackage('evolution')
@@ -115,13 +114,11 @@ special = {
]),
'emailinterface.txt': LayeredDocFileSuite(
'emailinterface.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=ProcessMailLayer,
stdout_logging=False)
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/app/browser/tests/test_views.py b/lib/lp/app/browser/tests/test_views.py
index c3e8615..c3187e1 100644
--- a/lib/lp/app/browser/tests/test_views.py
+++ b/lib/lp/app/browser/tests/test_views.py
@@ -26,7 +26,7 @@ bing_flag = FeatureFixture({'sitesearch.engine.name': 'bing'})
def setUp_bing(test):
- setUp(test, future=True)
+ setUp(test)
bing_flag.setUp()
@@ -48,12 +48,11 @@ special = {
# Run these doctests again with the default search engine.
'launchpad-search-pages.txt': LayeredDocFileSuite(
'../doc/launchpad-search-pages.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=PageTestLayer,
stdout_logging_level=logging.WARNING),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/app/tests/test_doc.py b/lib/lp/app/tests/test_doc.py
index 17b22e8..a702f5a 100644
--- a/lib/lp/app/tests/test_doc.py
+++ b/lib/lp/app/tests/test_doc.py
@@ -27,7 +27,7 @@ bing_flag = FeatureFixture({'sitesearch.engine.name': 'bing'})
def setUp_bing(test):
- setUpGlobs(test, future=True)
+ setUpGlobs(test)
bing_flag.setUp()
@@ -39,12 +39,12 @@ def tearDown_bing(test):
special = {
'tales.txt': LayeredDocFileSuite(
'../doc/tales.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'menus.txt': LayeredDocFileSuite(
'../doc/menus.txt',
- setUp=lambda test: setGlobs(test, future=True), layer=None,
+ setUp=setGlobs, layer=None,
),
'stories/launchpad-search(Bing)': PageTestSuite(
'../stories/launchpad-search/',
@@ -54,11 +54,10 @@ special = {
# Run these doctests again with the default search engine.
'../stories/launchpad-search': PageTestSuite(
'../stories/launchpad-search/',
- setUp=lambda test: setUpGlobs(test, future=True), tearDown=tearDown,
+ setUp=setUpGlobs, tearDown=tearDown,
),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/app/tests/test_validation.py b/lib/lp/app/tests/test_validation.py
index e560964..c300b51 100644
--- a/lib/lp/app/tests/test_validation.py
+++ b/lib/lp/app/tests/test_validation.py
@@ -24,8 +24,7 @@ def test_suite():
import lp.app.validators.validation
test = DocTestSuite(
lp.app.validators.validation,
- setUp=lambda test: setUp(test, future=True),
- tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
optionflags=ELLIPSIS | NORMALIZE_WHITESPACE
)
# We have to invoke the LaunchpadFunctionalLayer in order to
diff --git a/lib/lp/app/validators/tests/test_doc.py b/lib/lp/app/validators/tests/test_doc.py
index b4c1dfe..d9031ca 100644
--- a/lib/lp/app/validators/tests/test_doc.py
+++ b/lib/lp/app/validators/tests/test_doc.py
@@ -19,7 +19,7 @@ def test_suite():
suite = unittest.TestSuite()
test = LayeredDocFileSuite(
'validation.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer)
suite.addTest(test)
return suite
diff --git a/lib/lp/app/validators/tests/test_validators.py b/lib/lp/app/validators/tests/test_validators.py
index cb11eea..f5ec02b 100644
--- a/lib/lp/app/validators/tests/test_validators.py
+++ b/lib/lp/app/validators/tests/test_validators.py
@@ -43,7 +43,7 @@ def test_suite():
def suitefor(module):
"""Make a doctest suite with common setUp and tearDown functions."""
suite = DocTestSuite(
- module, setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ module, setUp=setUp, tearDown=tearDown,
optionflags=ELLIPSIS | NORMALIZE_WHITESPACE, checker=OutputChecker())
# We have to invoke the LaunchpadFunctionalLayer in order to
# initialize the ZCA machinery, which is a pre-requisite for using
diff --git a/lib/lp/app/widgets/tests/test_doc.py b/lib/lp/app/widgets/tests/test_doc.py
index fa66c2b..6970373 100644
--- a/lib/lp/app/widgets/tests/test_doc.py
+++ b/lib/lp/app/widgets/tests/test_doc.py
@@ -21,12 +21,11 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'image-widget.txt': LayeredDocFileSuite(
'../doc/image-widget.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/archivepublisher/tests/test_publisher_documentation.py b/lib/lp/archivepublisher/tests/test_publisher_documentation.py
index a211eb8..c59fce8 100644
--- a/lib/lp/archivepublisher/tests/test_publisher_documentation.py
+++ b/lib/lp/archivepublisher/tests/test_publisher_documentation.py
@@ -20,7 +20,7 @@ from lp.testing.systemdocs import (
def archivePublisherSetUp(test):
- setUp(test, future=True)
+ setUp(test)
switch_dbuser(config.archivepublisher.dbuser)
diff --git a/lib/lp/archiveuploader/tests/test_nascentupload_documentation.py b/lib/lp/archiveuploader/tests/test_nascentupload_documentation.py
index 311b84e..79f19c2 100644
--- a/lib/lp/archiveuploader/tests/test_nascentupload_documentation.py
+++ b/lib/lp/archiveuploader/tests/test_nascentupload_documentation.py
@@ -63,7 +63,7 @@ def testGlobalsSetup(test):
We can use the getUpload* without unnecessary imports.
"""
import_public_test_keys()
- setGlobs(test, future=True)
+ setGlobs(test)
test.globs['getUploadForSource'] = getUploadForSource
test.globs['getUploadForBinary'] = getUploadForBinary
test.globs['getPPAUploadForSource'] = getPPAUploadForSource
diff --git a/lib/lp/blueprints/browser/tests/test_views.py b/lib/lp/blueprints/browser/tests/test_views.py
index cd51d18..35a2159 100644
--- a/lib/lp/blueprints/browser/tests/test_views.py
+++ b/lib/lp/blueprints/browser/tests/test_views.py
@@ -109,7 +109,7 @@ def test_suite():
path = filename
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=DatabaseFunctionalLayer,
stdout_logging_level=logging.WARNING)
suite.addTest(one_test)
diff --git a/lib/lp/blueprints/tests/test_doc.py b/lib/lp/blueprints/tests/test_doc.py
index 5eec6ae..f3b80b7 100644
--- a/lib/lp/blueprints/tests/test_doc.py
+++ b/lib/lp/blueprints/tests/test_doc.py
@@ -6,14 +6,10 @@
import os
from lp.services.testing import build_test_suite
-from lp.testing.pages import setUpGlobs
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- return build_test_suite(
- here, setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here)
diff --git a/lib/lp/bugs/browser/tests/test_views.py b/lib/lp/bugs/browser/tests/test_views.py
index 14da9c6..f696aa0 100644
--- a/lib/lp/bugs/browser/tests/test_views.py
+++ b/lib/lp/bugs/browser/tests/test_views.py
@@ -45,7 +45,7 @@ def test_suite():
layer = special_test_layer.get(path, DatabaseFunctionalLayer)
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=layer, stdout_logging_level=logging.WARNING)
suite.addTest(one_test)
diff --git a/lib/lp/bugs/tests/test_buglinktarget.py b/lib/lp/bugs/tests/test_buglinktarget.py
index b5f5352..5d164d4 100644
--- a/lib/lp/bugs/tests/test_buglinktarget.py
+++ b/lib/lp/bugs/tests/test_buglinktarget.py
@@ -29,23 +29,23 @@ from lp.testing.systemdocs import (
def questionSetUp(test):
- setUp(test, future=True)
+ setUp(test)
test.globs['target'] = getUtility(IQuestionSet).get(1)
def cveSetUp(test):
- setUp(test, future=True)
+ setUp(test)
test.globs['target'] = getUtility(ICveSet)['2005-2730']
def specificationSetUp(test):
- setUp(test, future=True)
+ setUp(test)
test.globs['target'] = getUtility(ISpecificationSet).getByURL(
'http://wiki.mozilla.org/Firefox:1.1_Product_Team')
def branchMergeProposalSetUp(test):
- setUp(test, future=True)
+ setUp(test)
factory = LaunchpadObjectFactory()
test.globs['target'] = ProxyFactory(
factory.makeBranchMergeProposalForGit())
diff --git a/lib/lp/bugs/tests/test_bugtarget.py b/lib/lp/bugs/tests/test_bugtarget.py
index 9f1c5f4..e484118 100644
--- a/lib/lp/bugs/tests/test_bugtarget.py
+++ b/lib/lp/bugs/tests/test_bugtarget.py
@@ -42,7 +42,7 @@ def bugtarget_filebug(bugtarget, summary, status=None):
def productSetUp(test):
"""Setup the `IProduct` test."""
- setUp(test, future=True)
+ setUp(test)
test.globs['bugtarget'] = getUtility(IProductSet).getByName('firefox')
test.globs['filebug'] = bugtarget_filebug
test.globs['question_target'] = test.globs['bugtarget']
@@ -62,7 +62,7 @@ def project_filebug(project, summary, status=None):
def projectSetUp(test):
"""Setup the `IProjectGroup` test."""
- setUp(test, future=True)
+ setUp(test)
projectgroups = getUtility(IProjectGroupSet)
test.globs['bugtarget'] = projectgroups.getByName('mozilla')
test.globs['filebug'] = project_filebug
@@ -83,7 +83,7 @@ def productseries_filebug(productseries, summary, status=None):
def productSeriesSetUp(test):
"""Setup the `IProductSeries` test."""
- setUp(test, future=True)
+ setUp(test)
firefox = getUtility(IProductSet).getByName('firefox')
test.globs['bugtarget'] = firefox.getSeries('trunk')
test.globs['filebug'] = productseries_filebug
@@ -92,7 +92,7 @@ def productSeriesSetUp(test):
def distributionSetUp(test):
"""Setup the `IDistribution` test."""
- setUp(test, future=True)
+ setUp(test)
test.globs['bugtarget'] = getUtility(IDistributionSet).getByName('ubuntu')
test.globs['filebug'] = bugtarget_filebug
test.globs['question_target'] = test.globs['bugtarget']
@@ -100,7 +100,7 @@ def distributionSetUp(test):
def distributionSourcePackageSetUp(test):
"""Setup the `IDistributionSourcePackage` test."""
- setUp(test, future=True)
+ setUp(test)
ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
test.globs['bugtarget'] = ubuntu.getSourcePackage('mozilla-firefox')
test.globs['filebug'] = bugtarget_filebug
@@ -126,7 +126,7 @@ def distroseries_filebug(distroseries, summary, sourcepackagename=None,
def distributionSeriesSetUp(test):
"""Setup the `IDistroSeries` test."""
- setUp(test, future=True)
+ setUp(test)
ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
test.globs['bugtarget'] = ubuntu.getSeries('hoary')
test.globs['filebug'] = distroseries_filebug
diff --git a/lib/lp/bugs/tests/test_doc.py b/lib/lp/bugs/tests/test_doc.py
index f7a1e78..627025b 100644
--- a/lib/lp/bugs/tests/test_doc.py
+++ b/lib/lp/bugs/tests/test_doc.py
@@ -30,10 +30,7 @@ from lp.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
)
-from lp.testing.pages import (
- PageTestSuite,
- setUpGlobs,
- )
+from lp.testing.pages import PageTestSuite
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setGlobs,
@@ -48,12 +45,12 @@ here = os.path.dirname(os.path.realpath(__file__))
def lobotomizeSteveASetUp(test):
"""Call lobotomize_stevea() and standard setUp"""
lobotomize_stevea()
- setUp(test, future=True)
+ setUp(test)
def checkwatchesSetUp(test):
"""Setup the check watches script tests."""
- setUp(test, future=True)
+ setUp(test)
switch_dbuser(config.checkwatches.dbuser)
@@ -66,7 +63,7 @@ def branchscannerBugsSetUp(test):
def bugNotificationSendingSetUp(test):
lobotomize_stevea()
switch_dbuser(config.malone.bugnotification_dbuser)
- setUp(test, future=True)
+ setUp(test)
def bugNotificationSendingTearDown(test):
@@ -76,7 +73,7 @@ def bugNotificationSendingTearDown(test):
def cveSetUp(test):
lobotomize_stevea()
switch_dbuser(config.cveupdater.dbuser)
- setUp(test, future=True)
+ setUp(test)
def uploaderBugsSetUp(test):
@@ -89,7 +86,7 @@ def uploaderBugsSetUp(test):
lobotomize_stevea()
test_dbuser = config.uploader.dbuser
switch_dbuser(test_dbuser)
- setUp(test, future=True)
+ setUp(test)
test.globs['test_dbuser'] = test_dbuser
@@ -103,19 +100,19 @@ def uploadQueueTearDown(test):
def noPrivSetUp(test):
"""Set up a test logged in as no-priv."""
- setUp(test, future=True)
+ setUp(test)
login('no-priv@xxxxxxxxxxxxx')
def bugtaskExpirationSetUp(test):
"""Setup globs for bug expiration."""
- setUp(test, future=True)
+ setUp(test)
login('test@xxxxxxxxxxxxx')
def updateRemoteProductSetup(test):
"""Setup to use the 'updateremoteproduct' db user."""
- setUp(test, future=True)
+ setUp(test)
switch_dbuser(config.updateremoteproduct.dbuser)
@@ -126,17 +123,17 @@ def updateRemoteProductTeardown(test):
def bugSetStatusSetUp(test):
- setUp(test, future=True)
+ setUp(test)
test.globs['test_dbuser'] = config.processmail.dbuser
def bugmessageSetUp(test):
- setUp(test, future=True)
+ setUp(test)
login('no-priv@xxxxxxxxxxxxx')
def enableDSPPickerSetUp(test):
- setUp(test, future=True)
+ setUp(test)
ff = FeatureFixture({u'disclosure.dsp_picker.enabled': u'on'})
ff.setUp()
test.globs['dsp_picker_feature_fixture'] = ff
@@ -154,8 +151,7 @@ special = {
),
'bug-heat.txt': LayeredDocFileSuite(
'../doc/bug-heat.txt',
- setUp=lambda test: setUp(test, future=True),
- tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer
),
'bugnotificationrecipients.txt-uploader': LayeredDocFileSuite(
@@ -202,7 +198,7 @@ special = {
tearDown=bugNotificationSendingTearDown),
'bug-export.txt': LayeredDocFileSuite(
'../doc/bug-export.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer
),
'bug-set-status.txt': LayeredDocFileSuite(
@@ -228,7 +224,7 @@ special = {
'bugtask-package-widget.txt': LayeredDocFileSuite(
'../doc/bugtask-package-widget.txt',
id_extensions=['bugtask-package-widget.txt'],
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer
),
'bugtask-package-widget.txt-dsp-picker': LayeredDocFileSuite(
@@ -273,7 +269,7 @@ special = {
'bugwatch.txt':
LayeredDocFileSuite(
'../doc/bugwatch.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer
),
'bug-watch-activity.txt':
@@ -285,7 +281,7 @@ special = {
'bugtracker.txt':
LayeredDocFileSuite(
'../doc/bugtracker.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer
),
'checkwatches.txt':
@@ -306,7 +302,7 @@ special = {
'externalbugtracker.txt':
LayeredDocFileSuite(
'../doc/externalbugtracker.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
stdout_logging_level=logging.WARNING,
layer=LaunchpadZopelessLayer
),
@@ -458,7 +454,7 @@ special = {
),
'sourceforge-remote-products.txt': LayeredDocFileSuite(
'../doc/sourceforge-remote-products.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=LaunchpadZopelessLayer,
),
'bug-set-status.txt-processmail': LayeredDocFileSuite(
@@ -476,7 +472,7 @@ special = {
'bugs-emailinterface.txt-processmail': LayeredDocFileSuite(
'../tests/bugs-emailinterface.txt',
id_extensions=['bugs-emailinterface.txt-processmail'],
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=ProcessMailLayer,
stdout_logging=False),
}
@@ -486,15 +482,13 @@ def test_suite():
suite = unittest.TestSuite()
stories_dir = os.path.join(os.path.pardir, 'stories')
- suite.addTest(PageTestSuite(
- stories_dir, setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite(stories_dir))
stories_path = os.path.join(here, stories_dir)
for story_entry in scandir.scandir(stories_path):
if not story_entry.is_dir():
continue
story_path = os.path.join(stories_dir, story_entry.name)
- suite.addTest(PageTestSuite(
- story_path, setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite(story_path))
testsdir = os.path.abspath(
os.path.normpath(os.path.join(here, os.path.pardir, 'doc'))
@@ -514,7 +508,7 @@ def test_suite():
path = os.path.join('../doc/', filename)
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING
)
diff --git a/lib/lp/bugs/tests/test_externalbugtracker.py b/lib/lp/bugs/tests/test_externalbugtracker.py
index 40f5503..30b4918 100644
--- a/lib/lp/bugs/tests/test_externalbugtracker.py
+++ b/lib/lp/bugs/tests/test_externalbugtracker.py
@@ -21,19 +21,19 @@ def test_suite():
suite = unittest.TestSuite()
suite.addTest(LayeredDocFileSuite(
'bugzilla-xmlrpc-transport.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer))
suite.addTest(LayeredDocFileSuite(
'bugzilla-api-xmlrpc-transport.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer))
suite.addTest(LayeredDocFileSuite(
'trac-xmlrpc-transport.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer))
suite.addTest(LayeredDocFileSuite(
'externalbugtracker-xmlrpc-transport.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer))
return suite
diff --git a/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py b/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py
index c7a8107..cb559c9 100644
--- a/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py
+++ b/lib/lp/bugs/tests/test_structuralsubscriptiontarget.py
@@ -491,7 +491,7 @@ class TestGetAllStructuralSubscriptionsForTarget(TestCaseWithFactory):
def distributionSourcePackageSetUp(test):
- setUp(test, future=True)
+ setUp(test)
ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
test.globs['target'] = ubuntu.getSourcePackage('evolution')
test.globs['other_target'] = ubuntu.getSourcePackage('pmount')
@@ -499,13 +499,13 @@ def distributionSourcePackageSetUp(test):
def productSetUp(test):
- setUp(test, future=True)
+ setUp(test)
test.globs['target'] = getUtility(IProductSet).getByName('firefox')
test.globs['filebug'] = bugtarget_filebug
def distributionSetUp(test):
- setUp(test, future=True)
+ setUp(test)
test.globs['target'] = getUtility(IDistributionSet).getByName('ubuntu')
test.globs['filebug'] = bugtarget_filebug
@@ -517,7 +517,7 @@ def milestone_filebug(milestone, summary, status=None):
def milestoneSetUp(test):
- setUp(test, future=True)
+ setUp(test)
firefox = getUtility(IProductSet).getByName('firefox')
test.globs['target'] = firefox.getMilestone('1.0')
test.globs['filebug'] = milestone_filebug
@@ -535,7 +535,7 @@ def distroseries_sourcepackage_filebug(distroseries, summary, status=None):
def distroSeriesSourcePackageSetUp(test):
- setUp(test, future=True)
+ setUp(test)
test.globs['target'] = (
getUtility(IDistributionSet).getByName('ubuntu').getSeries('hoary'))
test.globs['filebug'] = distroseries_sourcepackage_filebug
diff --git a/lib/lp/buildmaster/tests/test_doc.py b/lib/lp/buildmaster/tests/test_doc.py
index ba56281..d6f3139 100644
--- a/lib/lp/buildmaster/tests/test_doc.py
+++ b/lib/lp/buildmaster/tests/test_doc.py
@@ -10,7 +10,6 @@ from lp.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
)
-from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setUp,
@@ -24,17 +23,14 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'builder.txt': LayeredDocFileSuite(
'../doc/builder.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer),
'buildqueue.txt': LayeredDocFileSuite(
'../doc/buildqueue.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer),
}
def test_suite():
- return build_test_suite(
- here, special, layer=LaunchpadZopelessLayer,
- setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here, special, layer=LaunchpadZopelessLayer)
diff --git a/lib/lp/code/tests/test_doc.py b/lib/lp/code/tests/test_doc.py
index 1ae5514..5d23a6d 100644
--- a/lib/lp/code/tests/test_doc.py
+++ b/lib/lp/code/tests/test_doc.py
@@ -16,7 +16,6 @@ from lp.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
)
-from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setGlobs,
@@ -31,7 +30,7 @@ here = os.path.dirname(os.path.realpath(__file__))
def branchscannerSetUp(test):
"""Setup the user for the branch scanner tests."""
switch_dbuser("branchscanner")
- setUp(test, future=True)
+ setUp(test)
def zopelessLaunchpadSecuritySetUp(test):
@@ -43,7 +42,7 @@ def zopelessLaunchpadSecuritySetUp(test):
functionality used in the webapp, it needs to use the
LaunchpadSecurityPolicy.
"""
- setGlobs(test, future=True)
+ setGlobs(test)
test.old_security_policy = setSecurityPolicy(LaunchpadSecurityPolicy)
@@ -65,28 +64,26 @@ special = {
),
'codeimport-result.txt': LayeredDocFileSuite(
'../doc/codeimport-result.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'branch-merge-proposal-notifications.txt': LayeredDocFileSuite(
'../doc/branch-merge-proposal-notifications.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
'branch-notifications.txt': LayeredDocFileSuite(
'../doc/branch-notifications.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
'codereviewcomment.txt': LayeredDocFileSuite(
'../doc/codereviewcomment.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/code/vocabularies/tests/test_doc.py b/lib/lp/code/vocabularies/tests/test_doc.py
index 7191eb0..e136049 100644
--- a/lib/lp/code/vocabularies/tests/test_doc.py
+++ b/lib/lp/code/vocabularies/tests/test_doc.py
@@ -8,12 +8,10 @@ Run the doctests.
import os
from lp.services.testing import build_doctest_suite
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- return build_doctest_suite(
- here, '', setUp=lambda test: setUp(test, future=True))
+ return build_doctest_suite(here, '')
diff --git a/lib/lp/coop/answersbugs/tests/test_doc.py b/lib/lp/coop/answersbugs/tests/test_doc.py
index 7e2d1d4..21886f3 100644
--- a/lib/lp/coop/answersbugs/tests/test_doc.py
+++ b/lib/lp/coop/answersbugs/tests/test_doc.py
@@ -29,7 +29,6 @@ from lp.testing.layers import (
LaunchpadZopelessLayer,
)
from lp.testing.mail_helpers import pop_notifications
-from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setUp,
@@ -74,7 +73,7 @@ def bugLinkedToQuestionSetUp(test):
def get_bugtask_linked_to_question():
return getUtility(IBugTaskSet).get(bugtask_id)
- setUp(test, future=True)
+ setUp(test)
bugtask_id = _createUbuntuBugTaskLinkedToQuestion()
test.globs['get_bugtask_linked_to_question'] = (
get_bugtask_linked_to_question)
@@ -125,7 +124,4 @@ special = {
def test_suite():
- return build_test_suite(
- here, special,
- setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/registry/browser/tests/test_views.py b/lib/lp/registry/browser/tests/test_views.py
index cb9bc72..02ac47f 100644
--- a/lib/lp/registry/browser/tests/test_views.py
+++ b/lib/lp/registry/browser/tests/test_views.py
@@ -57,7 +57,7 @@ def test_suite():
layer = special_test_layer.get(path, DatabaseFunctionalLayer)
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=layer, stdout_logging_level=logging.WARNING)
suite.addTest(one_test)
diff --git a/lib/lp/registry/tests/test_doc.py b/lib/lp/registry/tests/test_doc.py
index ec4302c..185094c 100644
--- a/lib/lp/registry/tests/test_doc.py
+++ b/lib/lp/registry/tests/test_doc.py
@@ -18,7 +18,6 @@ from lp.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
)
-from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setUp,
@@ -38,68 +37,59 @@ def peopleKarmaTearDown(test):
special = {
'distribution-mirror.txt': LayeredDocFileSuite(
'../doc/distribution-mirror.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'person-karma.txt': LayeredDocFileSuite(
'../doc/person-karma.txt',
- setUp=lambda test: setUp(test, future=True),
- tearDown=peopleKarmaTearDown,
+ setUp=setUp, tearDown=peopleKarmaTearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING
),
'product.txt': LayeredDocFileSuite(
'../doc/product.txt',
- setUp=lambda test: setUp(test, future=True),
- tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'private-team-roles.txt': LayeredDocFileSuite(
'../doc/private-team-roles.txt',
- setUp=lambda test: setUp(test, future=True),
- tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'productrelease.txt': LayeredDocFileSuite(
'../doc/productrelease.txt',
- setUp=lambda test: setUp(test, future=True),
- tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'productrelease-file-download.txt': LayeredDocFileSuite(
'../doc/productrelease-file-download.txt',
- setUp=lambda test: setUp(test, future=True),
- tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'standing.txt': LayeredDocFileSuite(
'../doc/standing.txt',
layer=LaunchpadZopelessLayer,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
),
'karmacache.txt': LayeredDocFileSuite(
'../doc/karmacache.txt',
layer=LaunchpadZopelessLayer,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown),
+ setUp=setUp, tearDown=tearDown),
'sourcepackage.txt': LayeredDocFileSuite(
'../doc/sourcepackage.txt',
layer=LaunchpadFunctionalLayer,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown),
+ setUp=setUp, tearDown=tearDown),
'distribution-sourcepackage.txt': LayeredDocFileSuite(
'../doc/distribution-sourcepackage.txt',
layer=LaunchpadZopelessLayer,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown),
+ setUp=setUp, tearDown=tearDown),
}
def test_suite():
- suite = build_test_suite(
- here, special, layer=DatabaseFunctionalLayer,
- setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ suite = build_test_suite(here, special, layer=DatabaseFunctionalLayer)
launchpadlib_path = os.path.join(os.path.pardir, 'doc', 'launchpadlib')
lplib_suite = build_doctest_suite(
- here, launchpadlib_path, layer=DatabaseFunctionalLayer,
- setUp=lambda test: setUp(test, future=True))
+ here, launchpadlib_path, layer=DatabaseFunctionalLayer)
suite.addTest(lplib_suite)
return suite
diff --git a/lib/lp/registry/tests/test_teammembership.py b/lib/lp/registry/tests/test_teammembership.py
index 97951d1..0c3317a 100644
--- a/lib/lp/registry/tests/test_teammembership.py
+++ b/lib/lp/registry/tests/test_teammembership.py
@@ -1342,6 +1342,6 @@ def test_suite():
bug_249185 = LayeredDocFileSuite(
'bug-249185.txt', optionflags=default_optionflags,
layer=DatabaseFunctionalLayer,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown)
+ setUp=setUp, tearDown=tearDown)
suite.addTest(bug_249185)
return suite
diff --git a/lib/lp/services/database/tests/test_decoratedresultset.py b/lib/lp/services/database/tests/test_decoratedresultset.py
index 7355caa..5b2b400 100644
--- a/lib/lp/services/database/tests/test_decoratedresultset.py
+++ b/lib/lp/services/database/tests/test_decoratedresultset.py
@@ -22,7 +22,7 @@ def test_suite():
test = LayeredDocFileSuite(
'decoratedresultset.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=DatabaseFunctionalLayer)
suite.addTest(test)
return suite
diff --git a/lib/lp/services/database/tests/test_doc.py b/lib/lp/services/database/tests/test_doc.py
index c5f1167..bb85450 100644
--- a/lib/lp/services/database/tests/test_doc.py
+++ b/lib/lp/services/database/tests/test_doc.py
@@ -9,14 +9,11 @@ import os
from lp.services.testing import build_test_suite
from lp.testing.layers import DatabaseFunctionalLayer
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- suite = build_test_suite(
- here, {}, setUp=lambda test: setUp(test, future=True),
- layer=DatabaseFunctionalLayer)
+ suite = build_test_suite(here, {}, layer=DatabaseFunctionalLayer)
return suite
diff --git a/lib/lp/services/feeds/tests/test_doc.py b/lib/lp/services/feeds/tests/test_doc.py
index bb6e9b8..b0414e4 100644
--- a/lib/lp/services/feeds/tests/test_doc.py
+++ b/lib/lp/services/feeds/tests/test_doc.py
@@ -8,8 +8,6 @@ Run the doctests and pagetests.
import os
from lp.services.testing import build_test_suite
-from lp.testing.pages import setUpGlobs
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
@@ -18,6 +16,4 @@ special = {}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/services/gpg/tests/test_doc.py b/lib/lp/services/gpg/tests/test_doc.py
index db5a275..5e032e6 100644
--- a/lib/lp/services/gpg/tests/test_doc.py
+++ b/lib/lp/services/gpg/tests/test_doc.py
@@ -9,13 +9,10 @@ import os
from lp.services.testing import build_test_suite
from lp.testing.layers import LaunchpadFunctionalLayer
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- return build_test_suite(
- here, layer=LaunchpadFunctionalLayer,
- setUp=lambda test: setUp(test, future=True))
+ return build_test_suite(here, layer=LaunchpadFunctionalLayer)
diff --git a/lib/lp/services/identity/tests/test_doc.py b/lib/lp/services/identity/tests/test_doc.py
index 621c854..b6e4289 100644
--- a/lib/lp/services/identity/tests/test_doc.py
+++ b/lib/lp/services/identity/tests/test_doc.py
@@ -9,14 +9,11 @@ import os
from lp.services.testing import build_test_suite
from lp.testing.layers import DatabaseFunctionalLayer
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- suite = build_test_suite(
- here, layer=DatabaseFunctionalLayer,
- setUp=lambda test: setUp(test, future=True))
+ suite = build_test_suite(here, layer=DatabaseFunctionalLayer)
return suite
diff --git a/lib/lp/services/inlinehelp/tests/test_doc.py b/lib/lp/services/inlinehelp/tests/test_doc.py
index 2bb6519..be51a5e 100644
--- a/lib/lp/services/inlinehelp/tests/test_doc.py
+++ b/lib/lp/services/inlinehelp/tests/test_doc.py
@@ -12,5 +12,4 @@ from lp.testing.systemdocs import (
def test_suite():
- return LayeredDocFileSuite(
- '../README.txt', setUp=lambda test: setGlobs(test, future=True))
+ return LayeredDocFileSuite('../README.txt', setUp=setGlobs)
diff --git a/lib/lp/services/librarianserver/tests/test_doc.py b/lib/lp/services/librarianserver/tests/test_doc.py
index f77fef5..da62503 100644
--- a/lib/lp/services/librarianserver/tests/test_doc.py
+++ b/lib/lp/services/librarianserver/tests/test_doc.py
@@ -139,12 +139,12 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'librarian-report.txt': LayeredDocFileSuite(
'../doc/librarian-report.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer
),
'upload.txt': LayeredDocFileSuite(
'../doc/upload.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
globs={'upload_request': upload_request},
),
@@ -152,5 +152,4 @@ special = {
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/services/mail/tests/test_doc.py b/lib/lp/services/mail/tests/test_doc.py
index 7a3f8ba..ed0f572 100644
--- a/lib/lp/services/mail/tests/test_doc.py
+++ b/lib/lp/services/mail/tests/test_doc.py
@@ -49,14 +49,12 @@ class ProcessMailLayer(LaunchpadZopelessLayer):
special = {
'emailauthentication.txt': LayeredDocFileSuite(
'../doc/emailauthentication.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=ProcessMailLayer,
stdout_logging=False)
}
def test_suite():
- suite = build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True),
- layer=DatabaseFunctionalLayer)
+ suite = build_test_suite(here, special, layer=DatabaseFunctionalLayer)
return suite
diff --git a/lib/lp/services/mail/tests/test_incoming.py b/lib/lp/services/mail/tests/test_incoming.py
index 15b751e..b442bb0 100644
--- a/lib/lp/services/mail/tests/test_incoming.py
+++ b/lib/lp/services/mail/tests/test_incoming.py
@@ -391,7 +391,7 @@ class TestExtractAddresses(TestCaseWithFactory):
def setUp(test):
- setGlobs(test, future=True)
+ setGlobs(test)
test._old_policy = setSecurityPolicy(LaunchpadSecurityPolicy)
switch_dbuser(config.processmail.dbuser)
diff --git a/lib/lp/services/mail/tests/test_mbox_mailer.py b/lib/lp/services/mail/tests/test_mbox_mailer.py
index f46248e..34fc6df 100644
--- a/lib/lp/services/mail/tests/test_mbox_mailer.py
+++ b/lib/lp/services/mail/tests/test_mbox_mailer.py
@@ -17,7 +17,7 @@ from lp.testing.systemdocs import (
def setup(testobj):
"""Set up for doc test"""
- setGlobs(testobj, future=True)
+ setGlobs(testobj)
fd, mbox_filename = tempfile.mkstemp()
os.close(fd)
testobj.globs['mbox_filename'] = mbox_filename
diff --git a/lib/lp/services/messages/tests/test_doc.py b/lib/lp/services/messages/tests/test_doc.py
index 8f61d74..4ed6e1e 100644
--- a/lib/lp/services/messages/tests/test_doc.py
+++ b/lib/lp/services/messages/tests/test_doc.py
@@ -9,14 +9,11 @@ import os
from lp.services.testing import build_test_suite
from lp.testing.layers import LaunchpadFunctionalLayer
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- suite = build_test_suite(
- here, {}, layer=LaunchpadFunctionalLayer,
- setUp=lambda test: setUp(test, future=True))
+ suite = build_test_suite(here, {}, layer=LaunchpadFunctionalLayer)
return suite
diff --git a/lib/lp/services/oauth/tests/test_doc.py b/lib/lp/services/oauth/tests/test_doc.py
index 0edb518..7ce594c 100644
--- a/lib/lp/services/oauth/tests/test_doc.py
+++ b/lib/lp/services/oauth/tests/test_doc.py
@@ -8,14 +8,10 @@ Run the doctests and pagetests.
import os
from lp.services.testing import build_test_suite
-from lp.testing.pages import setUpGlobs
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- return build_test_suite(
- here, setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here)
diff --git a/lib/lp/services/profile/tests.py b/lib/lp/services/profile/tests.py
index b299a83..91f708f 100644
--- a/lib/lp/services/profile/tests.py
+++ b/lib/lp/services/profile/tests.py
@@ -798,7 +798,7 @@ def test_suite():
doctest = LayeredDocFileSuite(
'./profiling.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer, stdout_logging_level=logging.WARNING)
suite.addTest(doctest)
suite.addTest(unittest.TestLoader().loadTestsFromName(__name__))
diff --git a/lib/lp/services/scripts/tests/test_doc.py b/lib/lp/services/scripts/tests/test_doc.py
index f8756dc..ded4d66 100644
--- a/lib/lp/services/scripts/tests/test_doc.py
+++ b/lib/lp/services/scripts/tests/test_doc.py
@@ -25,17 +25,16 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'script-monitoring.txt': LayeredDocFileSuite(
'../doc/script-monitoring.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
'launchpad-scripts.txt': LayeredDocFileSuite(
'../doc/launchpad-scripts.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=DatabaseLayer,
),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setGlobs(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/services/scripts/tests/test_logger.py b/lib/lp/services/scripts/tests/test_logger.py
index 9b9b2c8..6b6b082 100644
--- a/lib/lp/services/scripts/tests/test_logger.py
+++ b/lib/lp/services/scripts/tests/test_logger.py
@@ -58,7 +58,7 @@ def test_suite():
suite.addTest(
LayeredDocFileSuite(
'test_logger.txt',
- setUp=lambda test: setGlobs(test, future=True), layer=BaseLayer))
+ setUp=setGlobs, layer=BaseLayer))
suite.addTest(
unittest.TestLoader().loadTestsFromName(__name__))
return suite
diff --git a/lib/lp/services/temporaryblobstorage/tests/test_doc.py b/lib/lp/services/temporaryblobstorage/tests/test_doc.py
index f22077e..24de8de 100644
--- a/lib/lp/services/temporaryblobstorage/tests/test_doc.py
+++ b/lib/lp/services/temporaryblobstorage/tests/test_doc.py
@@ -9,8 +9,6 @@ import os
from lp.services.testing import build_test_suite
from lp.testing.layers import LaunchpadFunctionalLayer
-from lp.testing.pages import setUpGlobs
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
@@ -19,7 +17,4 @@ special = {}
def test_suite():
- return build_test_suite(
- here, special, layer=LaunchpadFunctionalLayer,
- setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here, special, layer=LaunchpadFunctionalLayer)
diff --git a/lib/lp/services/tests/test_doc.py b/lib/lp/services/tests/test_doc.py
index d15b126..937beb2 100644
--- a/lib/lp/services/tests/test_doc.py
+++ b/lib/lp/services/tests/test_doc.py
@@ -12,7 +12,6 @@ from lp.testing.layers import BaseLayer
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setGlobs,
- setUp,
)
@@ -22,15 +21,14 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'limitedlist.txt': LayeredDocFileSuite(
'../doc/limitedlist.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=BaseLayer),
'propertycache.txt': LayeredDocFileSuite(
'../doc/propertycache.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=BaseLayer),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/services/verification/browser/tests/test_views.py b/lib/lp/services/verification/browser/tests/test_views.py
index 2ec464f..b9cade8 100644
--- a/lib/lp/services/verification/browser/tests/test_views.py
+++ b/lib/lp/services/verification/browser/tests/test_views.py
@@ -34,7 +34,7 @@ def test_suite():
path = filename
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING
)
diff --git a/lib/lp/services/webapp/tests/test_authentication.py b/lib/lp/services/webapp/tests/test_authentication.py
index ff8036d..62ff98b 100644
--- a/lib/lp/services/webapp/tests/test_authentication.py
+++ b/lib/lp/services/webapp/tests/test_authentication.py
@@ -101,5 +101,5 @@ def test_suite():
suite.addTest(LayeredDocFileSuite(
'test_launchpad_login_source.txt',
layer=LaunchpadFunctionalLayer,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown))
+ setUp=setUp, tearDown=tearDown))
return suite
diff --git a/lib/lp/services/webapp/tests/test_doc.py b/lib/lp/services/webapp/tests/test_doc.py
index b4e50d8..e0772c0 100644
--- a/lib/lp/services/webapp/tests/test_doc.py
+++ b/lib/lp/services/webapp/tests/test_doc.py
@@ -29,7 +29,7 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'canonical_url.txt': LayeredDocFileSuite(
'../doc/canonical_url.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=FunctionalLayer,),
'notification-text-escape.txt': LayeredDocFileSuite(
'../doc/notification-text-escape.txt',
@@ -38,27 +38,24 @@ special = {
stdout_logging=False, layer=None),
'test_adapter.txt': LayeredDocFileSuite(
'../doc/test_adapter.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=LaunchpadFunctionalLayer),
# XXX Julian 2009-05-13, bug=376171
# Temporarily disabled because of intermittent failures.
# 'test_adapter_timeout.txt': LayeredDocFileSuite(
# '../doc/test_adapter_timeout.txt',
-# setUp=lambda test: setUp(test, future=True),
-# tearDown=tearDown,
+# setUp=setUp, tearDown=tearDown,
# layer=LaunchpadFunctionalLayer),
'test_adapter_permissions.txt': LayeredDocFileSuite(
'../doc/test_adapter_permissions.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=LaunchpadFunctionalLayer),
'uri.txt': LayeredDocFileSuite(
'../doc/uri.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=FunctionalLayer),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True),
- layer=LaunchpadFunctionalLayer)
+ return build_test_suite(here, special, layer=LaunchpadFunctionalLayer)
diff --git a/lib/lp/services/webapp/tests/test_preferredcharsets.py b/lib/lp/services/webapp/tests/test_preferredcharsets.py
index a350a3b..15da461 100644
--- a/lib/lp/services/webapp/tests/test_preferredcharsets.py
+++ b/lib/lp/services/webapp/tests/test_preferredcharsets.py
@@ -12,6 +12,4 @@ from lp.testing.systemdocs import (
def test_suite():
- return LayeredDocFileSuite(
- 'test_preferredcharsets.txt',
- setUp=lambda test: setGlobs(test, future=True))
+ return LayeredDocFileSuite('test_preferredcharsets.txt', setUp=setGlobs)
diff --git a/lib/lp/services/webservice/tests/test_doc.py b/lib/lp/services/webservice/tests/test_doc.py
index 47384c7..e623875 100644
--- a/lib/lp/services/webservice/tests/test_doc.py
+++ b/lib/lp/services/webservice/tests/test_doc.py
@@ -15,11 +15,9 @@ from lp.testing.layers import (
AppServerLayer,
LaunchpadFunctionalLayer,
)
-from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setGlobs,
- setUp,
)
@@ -34,8 +32,7 @@ def layerlessTearDown(test):
special = {
'webservice-configuration.txt': LayeredDocFileSuite(
'../doc/webservice-configuration.txt',
- setUp=lambda test: setGlobs(test, future=True),
- tearDown=layerlessTearDown,
+ setUp=setGlobs, tearDown=layerlessTearDown,
layer=None),
# This test is actually run twice to prove that the AppServerLayer
# properly isolates the database between tests.
@@ -50,7 +47,4 @@ special = {
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True),
- layer=LaunchpadFunctionalLayer)
+ return build_test_suite(here, special, layer=LaunchpadFunctionalLayer)
diff --git a/lib/lp/services/worlddata/tests/test_doc.py b/lib/lp/services/worlddata/tests/test_doc.py
index a786fdf..3754618 100644
--- a/lib/lp/services/worlddata/tests/test_doc.py
+++ b/lib/lp/services/worlddata/tests/test_doc.py
@@ -9,7 +9,6 @@ import os
from lp.services.testing import build_test_suite
from lp.testing.layers import LaunchpadZopelessLayer
-from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setUp,
@@ -22,11 +21,9 @@ special = {
'language.txt': LayeredDocFileSuite(
'../doc/language.txt',
layer=LaunchpadZopelessLayer,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown),
+ setUp=setUp, tearDown=tearDown),
}
def test_suite():
- return build_test_suite(
- here, special, setUp=lambda test: setUp(test, future=True),
- pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
+ return build_test_suite(here, special)
diff --git a/lib/lp/soyuz/browser/tests/test_views.py b/lib/lp/soyuz/browser/tests/test_views.py
index b4256ee..d621dd0 100644
--- a/lib/lp/soyuz/browser/tests/test_views.py
+++ b/lib/lp/soyuz/browser/tests/test_views.py
@@ -32,7 +32,7 @@ def test_suite():
path = filename
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING
)
diff --git a/lib/lp/soyuz/tests/test_doc.py b/lib/lp/soyuz/tests/test_doc.py
index b1f15dc..e8fdd5f 100644
--- a/lib/lp/soyuz/tests/test_doc.py
+++ b/lib/lp/soyuz/tests/test_doc.py
@@ -19,10 +19,7 @@ from lp.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
)
-from lp.testing.pages import (
- PageTestSuite,
- setUpGlobs,
- )
+from lp.testing.pages import PageTestSuite
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setUp,
@@ -57,7 +54,7 @@ def lobotomize_stevea():
def uploaderSetUp(test):
"""setup the package uploader script tests."""
- setUp(test, future=True)
+ setUp(test)
switch_dbuser('uploader')
@@ -65,7 +62,7 @@ def statisticianSetUp(test):
test_dbuser = config.statistician.dbuser
test.globs['test_dbuser'] = test_dbuser
switch_dbuser(test_dbuser)
- setUp(test, future=True)
+ setUp(test)
def statisticianTearDown(test):
@@ -76,7 +73,7 @@ def uploadQueueSetUp(test):
lobotomize_stevea()
test_dbuser = config.uploadqueue.dbuser
switch_dbuser(test_dbuser)
- setUp(test, future=True)
+ setUp(test)
test.globs['test_dbuser'] = test_dbuser
@@ -90,7 +87,7 @@ def uploaderBugsSetUp(test):
lobotomize_stevea()
test_dbuser = config.uploader.dbuser
switch_dbuser(test_dbuser)
- setUp(test, future=True)
+ setUp(test)
test.globs['test_dbuser'] = test_dbuser
@@ -110,7 +107,7 @@ special = {
),
'distroarchseriesbinarypackage.txt': LayeredDocFileSuite(
'../doc/distroarchseriesbinarypackage.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer
),
'closing-bugs-from-changelogs.txt': LayeredDocFileSuite(
@@ -128,7 +125,7 @@ special = {
),
'soyuz-set-of-uploads.txt': LayeredDocFileSuite(
'../doc/soyuz-set-of-uploads.txt',
- setUp=lambda test: setUp(test, future=True),
+ setUp=setUp,
layer=LaunchpadZopelessLayer,
),
'package-relationship.txt': LayeredDocFileSuite(
@@ -136,27 +133,27 @@ special = {
stdout_logging=False, layer=None),
'publishing.txt': LayeredDocFileSuite(
'../doc/publishing.txt',
- setUp=lambda test: setUp(test, future=True),
+ setUp=setUp,
layer=LaunchpadZopelessLayer,
),
'build-failedtoupload-workflow.txt': LayeredDocFileSuite(
'../doc/build-failedtoupload-workflow.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
'distroseriesqueue.txt': LayeredDocFileSuite(
'../doc/distroseriesqueue.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
'distroseriesqueue-notify.txt': LayeredDocFileSuite(
'../doc/distroseriesqueue-notify.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
'distroseriesqueue-translations.txt': LayeredDocFileSuite(
'../doc/distroseriesqueue-translations.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadZopelessLayer,
),
}
@@ -166,15 +163,13 @@ def test_suite():
suite = unittest.TestSuite()
stories_dir = os.path.join(os.path.pardir, 'stories')
- suite.addTest(PageTestSuite(
- stories_dir, setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite(stories_dir))
stories_path = os.path.join(here, stories_dir)
for story_entry in scandir.scandir(stories_path):
if not story_entry.is_dir():
continue
story_path = os.path.join(stories_dir, story_entry.name)
- suite.addTest(PageTestSuite(
- story_path, setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite(story_path))
# Add special needs tests
for key in sorted(special):
@@ -195,7 +190,7 @@ def test_suite():
path = os.path.join('../doc', filename)
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING)
suite.addTest(one_test)
diff --git a/lib/lp/testing/pages.py b/lib/lp/testing/pages.py
index fa6d0a4..2f8c0f8 100644
--- a/lib/lp/testing/pages.py
+++ b/lib/lp/testing/pages.py
@@ -833,10 +833,7 @@ def permissive_security_policy(dbuser_name=None):
setSecurityPolicy(old_policy)
-# XXX cjwatson 2018-05-13: Once all doctests are made safe for the standard
-# __future__ imports, the `future=True` behaviour should become
-# unconditional.
-def setUpGlobs(test, future=False):
+def setUpGlobs(test):
test.globs['transaction'] = transaction
test.globs['http'] = http
test.globs['webservice'] = LaunchpadWebServiceCaller(
@@ -896,12 +893,6 @@ def setUpGlobs(test, future=False):
test.globs['six'] = six
test.globs['backslashreplace'] = backslashreplace
- if future:
- import __future__
- for future_item in (
- 'absolute_import', 'print_function', 'unicode_literals'):
- test.globs[future_item] = getattr(__future__, future_item)
-
# This function name doesn't follow our standard naming conventions,
# but does follow the convention of the other doctest related *Suite()
diff --git a/lib/lp/testing/systemdocs.py b/lib/lp/testing/systemdocs.py
index 5e9bdac..6c3f80a 100644
--- a/lib/lp/testing/systemdocs.py
+++ b/lib/lp/testing/systemdocs.py
@@ -247,10 +247,7 @@ class PrettyPrinter(pprint.PrettyPrinter, object):
del _dispatch[bytearray.__repr__]
-# XXX cjwatson 2018-05-13: Once all doctests are made safe for the standard
-# __future__ imports, the `future=True` behaviour should become
-# unconditional.
-def setGlobs(test, future=False):
+def setGlobs(test):
"""Add the common globals for testing system documentation."""
test.globs['ANONYMOUS'] = ANONYMOUS
test.globs['login'] = login
@@ -273,16 +270,10 @@ def setGlobs(test, future=False):
test.globs['six'] = six
test.globs['backslashreplace'] = backslashreplace
- if future:
- import __future__
- for future_item in (
- 'absolute_import', 'print_function', 'unicode_literals'):
- test.globs[future_item] = getattr(__future__, future_item)
-
-def setUp(test, future=False):
+def setUp(test):
"""Setup the common globals and login for testing system documentation."""
- setGlobs(test, future=future)
+ setGlobs(test)
# Set up an anonymous interaction.
login(ANONYMOUS)
diff --git a/lib/lp/testing/tests/test_doc.py b/lib/lp/testing/tests/test_doc.py
index 66783e9..7ce594c 100644
--- a/lib/lp/testing/tests/test_doc.py
+++ b/lib/lp/testing/tests/test_doc.py
@@ -8,11 +8,10 @@ Run the doctests and pagetests.
import os
from lp.services.testing import build_test_suite
-from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
def test_suite():
- return build_test_suite(here, setUp=lambda test: setUp(test, future=True))
+ return build_test_suite(here)
diff --git a/lib/lp/testopenid/stories/tests.py b/lib/lp/testopenid/stories/tests.py
index f1d9e83..0c0d88e 100644
--- a/lib/lp/testopenid/stories/tests.py
+++ b/lib/lp/testopenid/stories/tests.py
@@ -6,10 +6,7 @@ import unittest
import scandir
-from lp.testing.pages import (
- PageTestSuite,
- setUpGlobs,
- )
+from lp.testing.pages import PageTestSuite
here = os.path.dirname(os.path.realpath(__file__))
@@ -21,10 +18,8 @@ def test_suite():
if not entry.name.startswith('.') and entry.is_dir())
suite = unittest.TestSuite()
- suite.addTest(PageTestSuite(
- '.', setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite('.'))
for storydir in stories:
- suite.addTest(PageTestSuite(
- storydir, setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite(storydir))
return suite
diff --git a/lib/lp/translations/browser/tests/test_views.py b/lib/lp/translations/browser/tests/test_views.py
index 02a404c..3a0020c 100644
--- a/lib/lp/translations/browser/tests/test_views.py
+++ b/lib/lp/translations/browser/tests/test_views.py
@@ -34,7 +34,7 @@ def test_suite():
path = filename
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING)
suite.addTest(one_test)
diff --git a/lib/lp/translations/tests/test_doc.py b/lib/lp/translations/tests/test_doc.py
index b82e9fc..9229590 100644
--- a/lib/lp/translations/tests/test_doc.py
+++ b/lib/lp/translations/tests/test_doc.py
@@ -15,10 +15,7 @@ from lp.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
)
-from lp.testing.pages import (
- PageTestSuite,
- setUpGlobs,
- )
+from lp.testing.pages import PageTestSuite
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setGlobs,
@@ -33,27 +30,27 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'poexport-queue.txt': LayeredDocFileSuite(
'../doc/poexport-queue.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'translationimportqueue.txt': LayeredDocFileSuite(
'../doc/translationimportqueue.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'rosetta-karma.txt': LayeredDocFileSuite(
'../doc/rosetta-karma.txt',
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
),
'translationmessage-destroy.txt': LayeredDocFileSuite(
'../doc/translationmessage-destroy.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=LaunchpadZopelessLayer,
),
'translationsoverview.txt': LayeredDocFileSuite(
'../doc/translationsoverview.txt',
- setUp=lambda test: setGlobs(test, future=True),
+ setUp=setGlobs,
layer=LaunchpadZopelessLayer,
),
}
@@ -63,15 +60,13 @@ def test_suite():
suite = unittest.TestSuite()
stories_dir = os.path.join(os.path.pardir, 'stories')
- suite.addTest(PageTestSuite(
- stories_dir, setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite(stories_dir))
stories_path = os.path.join(here, stories_dir)
for story_entry in scandir.scandir(stories_path):
if not story_entry.is_dir():
continue
story_path = os.path.join(stories_dir, story_entry.name)
- suite.addTest(PageTestSuite(
- story_path, setUp=lambda test: setUpGlobs(test, future=True)))
+ suite.addTest(PageTestSuite(story_path))
testsdir = os.path.abspath(
os.path.normpath(os.path.join(here, os.path.pardir, 'doc')))
@@ -91,7 +86,7 @@ def test_suite():
path = os.path.join('../doc/', filename)
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING)
suite.addTest(one_test)
diff --git a/lib/lp/translations/utilities/tests/test_system_documentation.py b/lib/lp/translations/utilities/tests/test_system_documentation.py
index 8f1af4f..2e41644 100644
--- a/lib/lp/translations/utilities/tests/test_system_documentation.py
+++ b/lib/lp/translations/utilities/tests/test_system_documentation.py
@@ -26,7 +26,7 @@ here = os.path.dirname(os.path.realpath(__file__))
special = {
'gettext_po_parser.txt': LayeredDocFileSuite(
'../doc/gettext_po_parser.txt',
- setUp=lambda test: setGlobs(test, future=True), stdout_logging=False)
+ setUp=setGlobs, stdout_logging=False)
}
@@ -60,7 +60,7 @@ def test_suite():
path = os.path.join('../doc/', filename)
one_test = LayeredDocFileSuite(
path,
- setUp=lambda test: setUp(test, future=True), tearDown=tearDown,
+ setUp=setUp, tearDown=tearDown,
layer=LaunchpadFunctionalLayer,
stdout_logging_level=logging.WARNING
)