launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22062
[Merge] lp:~cjwatson/launchpad/upgrade-testtools into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/upgrade-testtools into lp:launchpad with lp:~cjwatson/launchpad/upgrade-keystoneclient-swiftclient as a prerequisite.
Commit message:
Upgrade to testtools 2.3.0 and fixtures 3.0.0.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/upgrade-testtools/+merge/335395
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/upgrade-testtools into lp:launchpad.
=== modified file 'constraints.txt'
--- constraints.txt 2017-12-19 17:24:37 +0000
+++ constraints.txt 2017-12-19 17:24:37 +0000
@@ -140,7 +140,7 @@
setuptools==36.4.0
Sphinx==1.0.8
#testtools==0.9.12
-testtools==0.9.30
+testtools==2.3.0
transaction==1.1.1
z3c.recipe.sphinxdoc==0.0.8
zc.buildout==1.7.1
@@ -245,10 +245,10 @@
dnspython==1.10.0
elementtree==1.2.6-20050316
epydoc==3.0.1
-extras==0.0.3
+extras==1.0.0
feedparser==4.1
feedvalidator==0.0.0DEV-r1049
-fixtures==0.3.9
+fixtures==3.0.0
FormEncode==1.2.4
grokcore.component==1.6
html5browser==0.0.9
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2017-05-08 11:38:20 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2017-12-19 17:24:37 +0000
@@ -1630,7 +1630,6 @@
layer = DatabaseFunctionalLayer
def _setupBugData(self):
- super(TestConjoinedBugTasks, self).setUp()
owner = self.factory.makePerson()
distro = self.factory.makeDistribution(name="eggs", owner=owner,
bug_supervisor=owner)
=== modified file 'lib/lp/code/tests/helpers.py'
--- lib/lp/code/tests/helpers.py 2017-10-04 01:53:48 +0000
+++ lib/lp/code/tests/helpers.py 2017-12-19 17:24:37 +0000
@@ -324,8 +324,7 @@
self.delete = FakeMethod()
self.disable_memcache = disable_memcache
- def setUp(self):
- super(GitHostingFixture, self).setUp()
+ def _setUp(self):
self.useFixture(ZopeUtilityFixture(self, IGitHostingClient))
if self.disable_memcache:
# Most tests that involve GitRef._getLog don't want to cache the
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py 2017-01-12 18:01:56 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2017-12-19 17:24:37 +0000
@@ -1266,12 +1266,12 @@
stacked_on_url=stacked_on_url)
def test_partial(self):
- self.skip(
+ self.skipTest(
"Partial fetching is not supported for native bzr branches "
"at the moment.")
def test_unsupported_feature(self):
- self.skip("All Bazaar features are supported by Bazaar.")
+ self.skipTest("All Bazaar features are supported by Bazaar.")
def test_reject_branch_reference(self):
# Branch references are allowed in the BzrImporter, but their URL
=== modified file 'lib/lp/codehosting/vfs/tests/test_branchfs.py'
--- lib/lp/codehosting/vfs/tests/test_branchfs.py 2013-08-16 05:16:44 +0000
+++ lib/lp/codehosting/vfs/tests/test_branchfs.py 2017-12-19 17:24:37 +0000
@@ -41,7 +41,6 @@
from testtools.deferredruntest import (
assert_fails_with,
AsynchronousDeferredRunTest,
- run_with_log_observers,
)
from twisted.internet import defer
@@ -1013,6 +1012,8 @@
class TestBranchChangedErrorHandling(TestCaseWithTransport, TestCase):
"""Test handling of errors when branchChange is called."""
+ run_tests_with = AsynchronousDeferredRunTest
+
def setUp(self):
super(TestBranchChangedErrorHandling, self).setUp()
self._server = None
@@ -1065,8 +1066,7 @@
# endpoint. We will then check the error handling.
db_branch = self.factory.makeAnyBranch(
branch_type=BranchType.HOSTED, owner=self.requester)
- branch = run_with_log_observers(
- [], self.make_branch, db_branch.unique_name)
+ branch = self.make_branch(db_branch.unique_name)
branch.lock_write()
branch.unlock()
stderr_text = sys.stderr.getvalue()
=== modified file 'lib/lp/registry/tests/test_subscribers.py'
--- lib/lp/registry/tests/test_subscribers.py 2015-10-01 17:32:41 +0000
+++ lib/lp/registry/tests/test_subscribers.py 2017-12-19 17:24:37 +0000
@@ -99,8 +99,6 @@
layer = DatabaseFunctionalLayer
def make_product_user(self, licenses):
- # Setup an a view that implements ProductLicenseMixin.
- super(LicenseNotificationTestCase, self).setUp()
user = self.factory.makePerson(
name='registrant', email='registrant@xxxxxxxxxxxxx')
login_person(user)
=== modified file 'lib/lp/scripts/runlaunchpad.py'
--- lib/lp/scripts/runlaunchpad.py 2017-09-23 03:13:41 +0000
+++ lib/lp/scripts/runlaunchpad.py 2017-12-19 17:24:37 +0000
@@ -49,8 +49,7 @@
"""
raise NotImplementedError
- def setUp(self):
- super(Service, self).setUp()
+ def _setUp(self):
self.launch()
=== modified file 'lib/lp/services/config/fixture.py'
--- lib/lp/services/config/fixture.py 2016-10-11 15:28:25 +0000
+++ lib/lp/services/config/fixture.py 2017-12-19 17:24:37 +0000
@@ -48,8 +48,7 @@
if config.instance_name == self.instance_name:
config._invalidateConfig()
- def setUp(self):
- super(ConfigFixture, self).setUp()
+ def _setUp(self):
root = os.path.join(config.root, 'configs', self.instance_name)
os.mkdir(root)
self.absroot = os.path.abspath(root)
@@ -70,7 +69,6 @@
def __init__(self, instance_name):
self.instance_name = instance_name
- def setUp(self):
- super(ConfigUseFixture, self).setUp()
+ def _setUp(self):
self.addCleanup(config.setInstance, config.instance_name)
config.setInstance(self.instance_name)
=== modified file 'lib/lp/services/features/testing.py'
--- lib/lp/services/features/testing.py 2014-02-26 00:45:07 +0000
+++ lib/lp/services/features/testing.py 2017-12-19 17:24:37 +0000
@@ -60,10 +60,8 @@
self.full_feature_rules = full_feature_rules
self.override_scope_lookup = override_scope_lookup
- def setUp(self):
+ def _setUp(self):
"""Set the feature flags that this fixture is responsible for."""
- super(FeatureFixtureMixin, self).setUp()
-
rule_source = self.makeRuleSource(self.makeNewRules())
original_controller = get_relevant_feature_controller()
=== modified file 'lib/lp/services/librarianserver/testing/fake.py'
--- lib/lp/services/librarianserver/testing/fake.py 2016-04-02 01:33:35 +0000
+++ lib/lp/services/librarianserver/testing/fake.py 2017-12-19 17:24:37 +0000
@@ -70,9 +70,8 @@
utility.
"""
- def setUp(self):
+ def _setUp(self):
"""Fixture API: install as the librarian."""
- Fixture.setUp(self)
self.aliases = {}
self.download_url = config.librarian.download_url
transaction.manager.registerSynch(self)
=== modified file 'lib/lp/services/librarianserver/testing/tests/test_server_fixture.py'
--- lib/lp/services/librarianserver/testing/tests/test_server_fixture.py 2012-04-16 23:02:44 +0000
+++ lib/lp/services/librarianserver/testing/tests/test_server_fixture.py 2017-12-19 17:24:37 +0000
@@ -28,7 +28,7 @@
def skip_if_persistent(self, fixture):
if fixture._persistent_servers():
- self.skip('persistent server running.')
+ self.skipTest('persistent server running.')
def test_on_init_no_pid(self):
fixture = LibrarianServerFixture(BaseLayer.config_fixture)
=== modified file 'lib/lp/services/memcache/testing.py'
--- lib/lp/services/memcache/testing.py 2016-09-07 03:43:36 +0000
+++ lib/lp/services/memcache/testing.py 2017-12-19 17:24:37 +0000
@@ -18,8 +18,7 @@
def __init__(self):
self._cache = {}
- def setUp(self):
- super(MemcacheFixture, self).setUp()
+ def _setUp(self):
self.useFixture(ZopeUtilityFixture(self, IMemcacheClient))
def get(self, key):
=== modified file 'lib/lp/services/utils.py'
--- lib/lp/services/utils.py 2016-10-12 14:02:19 +0000
+++ lib/lp/services/utils.py 2017-12-19 17:24:37 +0000
@@ -257,8 +257,7 @@
self.stdout = StringIO()
self.stderr = StringIO()
- def setUp(self):
- super(CapturedOutput, self).setUp()
+ def _setUp(self):
self.useFixture(MonkeyPatch('sys.stdout', self.stdout))
self.useFixture(MonkeyPatch('sys.stderr', self.stderr))
=== modified file 'lib/lp/snappy/browser/tests/test_snap.py'
--- lib/lp/snappy/browser/tests/test_snap.py 2017-10-20 13:35:42 +0000
+++ lib/lp/snappy/browser/tests/test_snap.py 2017-12-19 17:24:37 +0000
@@ -326,11 +326,11 @@
owner=self.person,
information_type=InformationType.USERDATA)
- with self.useFixture(FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: ""})):
+ with FeatureFixture({SNAP_PRIVATE_FEATURE_FLAG: ""}):
browser = self.getViewBrowser(branch, user=self.person)
self.assertRaises(
LinkNotFoundError, browser.getLink, "Create snap package")
- with self.useFixture(FeatureFixture(SNAP_TESTING_FLAGS)):
+ with FeatureFixture(SNAP_TESTING_FLAGS):
browser = self.getViewBrowser(branch, user=self.person)
browser.getLink("Create snap package")
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2017-04-29 23:51:28 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2017-12-19 17:24:37 +0000
@@ -1319,8 +1319,7 @@
"://+%s:%s@" % (token.name, token.token), token.archive_url)
self.assertDictEqual(
{"token": token.token, "archive_url": token.archive_url},
- res
- )
+ removeSecurityProxy(res))
def test_newNamedAuthToken_public_archive(self):
public_ppa = self.factory.makeArchive(private=False)
@@ -1340,7 +1339,9 @@
res = self.private_ppa.newNamedAuthTokens(
(u"name1", u"name2"), as_dict=True)
tokens = self.private_ppa.getNamedAuthTokens()
- self.assertDictEqual({tok.name: tok.asDict() for tok in tokens}, res)
+ self.assertDictEqual(
+ {tok.name: tok.asDict() for tok in tokens},
+ removeSecurityProxy(res))
def test_newNamedAuthTokens_public_archive(self):
public_ppa = self.factory.makeArchive(private=False)
@@ -1352,7 +1353,9 @@
res = self.private_ppa.newNamedAuthTokens(
(u"tok1", u"tok2", u"tok3"), as_dict=True)
tokens = self.private_ppa.getNamedAuthTokens()
- self.assertDictEqual({tok.name: tok.asDict() for tok in tokens}, res)
+ self.assertDictEqual(
+ {tok.name: tok.asDict() for tok in tokens},
+ removeSecurityProxy(res))
def test_newNamedAuthTokens_idempotent(self):
names = (u"name1", u"name2", u"name3", u"name4", u"name5")
@@ -3717,7 +3720,8 @@
"total": 4,
}
self.assertDictEqual(
- expected_counters, cprov_archive.getBuildCounters())
+ expected_counters,
+ removeSecurityProxy(cprov_archive.getBuildCounters()))
def test_ubuntu_build_counters_in_sampledata(self):
ubuntu_archive = getUtility(IDistributionSet)["ubuntu"].main_archive
@@ -3729,13 +3733,15 @@
"total": 18,
}
self.assertDictEqual(
- expected_counters, ubuntu_archive.getBuildCounters())
+ expected_counters,
+ removeSecurityProxy(ubuntu_archive.getBuildCounters()))
# include_needsbuild=False excludes builds in status NEEDSBUILD.
expected_counters["pending"] -= 1
expected_counters["total"] -= 1
self.assertDictEqual(
expected_counters,
- ubuntu_archive.getBuildCounters(include_needsbuild=False))
+ removeSecurityProxy(
+ ubuntu_archive.getBuildCounters(include_needsbuild=False)))
def assertBuildSummaryMatches(self, status, builds, summary):
self.assertEqual(status, summary["status"])
=== modified file 'lib/lp/testing/fixture.py'
--- lib/lp/testing/fixture.py 2017-09-02 13:29:14 +0000
+++ lib/lp/testing/fixture.py 2017-12-19 17:24:37 +0000
@@ -156,8 +156,7 @@
def __init__(self, *args, **kwargs):
self._args, self._kwargs = args, kwargs
- def setUp(self):
- super(ZopeAdapterFixture, self).setUp()
+ def _setUp(self):
site_manager = getGlobalSiteManager()
site_manager.registerAdapter(
*self._args, **self._kwargs)
@@ -173,8 +172,7 @@
super(ZopeEventHandlerFixture, self).__init__()
self._handler = handler
- def setUp(self):
- super(ZopeEventHandlerFixture, self).setUp()
+ def _setUp(self):
gsm = getGlobalSiteManager()
provideHandler(self._handler)
self.addCleanup(gsm.unregisterHandler, self._handler)
@@ -207,8 +205,7 @@
'Try a layer.')
self.replacement = replacement
- def setUp(self):
- super(ZopeViewReplacementFixture, self).setUp()
+ def _setUp(self):
if self.replacement is None:
raise ValueError('replacement is not set')
self.gsm.adapters.register(
@@ -243,8 +240,7 @@
self.name = name
self.intf = intf
- def setUp(self):
- super(ZopeUtilityFixture, self).setUp()
+ def _setUp(self):
gsm = getGlobalSiteManager()
original = gsm.queryUtility(self.intf, self.name)
gsm.registerUtility(self.component, self.intf, self.name)
@@ -263,10 +259,9 @@
that is all that is needed. Later work could connect all
sub-hosts (e.g. bugs.launchpad.dev)."""
- def setUp(self):
+ def _setUp(self):
# Work around circular import.
from lp.testing.layers import wsgi_application
- super(Urllib2Fixture, self).setUp()
add_wsgi_intercept('launchpad.dev', 80, lambda: wsgi_application)
self.addCleanup(remove_wsgi_intercept, 'launchpad.dev', 80)
install_opener()
@@ -284,8 +279,7 @@
AMQP_SENTINEL = "STOP NOW"
- def setUp(self):
- super(CaptureOops, self).setUp()
+ def _setUp(self):
self.oopses = []
self.oops_ids = set()
self.useFixture(ZopeEventHandlerFixture(self._recordOops))
@@ -372,8 +366,7 @@
reset the timeline.
"""
- def setUp(self):
- Fixture.setUp(self)
+ def _setUp(self):
webapp.adapter.set_request_started(time.time())
self.timeline = get_request_timeline(
get_current_browser_request())
@@ -387,8 +380,7 @@
other things.
"""
- def setUp(self):
- Fixture.setUp(self)
+ def _setUp(self):
config.push('demo-fixture', '''
[launchpad]
is_demo: true
@@ -404,8 +396,7 @@
def __init__(self, table_triggers=None):
self.table_triggers = table_triggers or {}
- def setUp(self):
- super(DisableTriggerFixture, self).setUp()
+ def _setUp(self):
self._disable_triggers()
self.addCleanup(self._enable_triggers)
=== modified file 'lib/lp/testing/tests/test_layers_functional.py'
--- lib/lp/testing/tests/test_layers_functional.py 2015-10-13 14:01:25 +0000
+++ lib/lp/testing/tests/test_layers_functional.py 2017-12-19 17:24:37 +0000
@@ -76,8 +76,7 @@
super(BaseLayerIsolator, self).__init__()
self.with_persistent = with_persistent
- def setUp(self):
- super(BaseLayerIsolator, self).setUp()
+ def _setUp(self):
if self.with_persistent:
env_value = ''
else:
@@ -103,8 +102,7 @@
super(LayerFixture, self).__init__()
self.layer = layer
- def setUp(self):
- super(LayerFixture, self).setUp()
+ def _setUp(self):
self.layer.setUp()
self.addCleanup(self.layer.tearDown)
=== modified file 'lib/lp/testing/tests/test_matchers.py'
--- lib/lp/testing/tests/test_matchers.py 2017-11-04 23:21:54 +0000
+++ lib/lp/testing/tests/test_matchers.py 2017-12-19 17:24:37 +0000
@@ -376,7 +376,7 @@
matcher = EqualsIgnoringWhitespace("one \t two \n three")
mismatch = matcher.match(" one \r three ")
self.assertEqual(
- "'one two three' != 'one three'",
+ "'one three' != 'one two three'",
mismatch.describe())
def test_match_unicode(self):
@@ -387,7 +387,7 @@
matcher = EqualsIgnoringWhitespace(u"one \t two \n \u1234 ")
mismatch = matcher.match(u" one \r \u1234 ")
self.assertEqual(
- u"u'one two \\u1234' != u'one \\u1234'",
+ u"u'one \\u1234' != u'one two \\u1234'",
mismatch.describe())
def test_match_non_string(self):
Follow ups