Colin Watson has proposed merging ~cjwatson/launchpad:pre-commit-update into launchpad:master.
Commit message: Update pre-commit hooks Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/435740 `pyupgrade` no longer has a Python-2-compatible mode, so I dropped the `--py3-plus` option; and I fixed a few new `shellcheck` warnings manually. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pre-commit-update into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8c58be9..20f050e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-ast @@ -24,17 +24,17 @@ repos: - id: no-commit-to-branch args: [--branch, master, --branch, db-devel] - repo: https://github.com/asottile/pyupgrade - rev: v2.37.3 + rev: v3.3.1 hooks: - id: pyupgrade - args: [--keep-percent-format, --py3-plus] + args: [--keep-percent-format] exclude: | (?x)^( lib/contrib/.* |utilities/community-contributions\.py )$ - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 22.12.0 hooks: - id: black exclude: | @@ -43,25 +43,25 @@ repos: |utilities/community-contributions\.py )$ - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.11.4 hooks: - id: isort name: isort args: [--profile, black] - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 exclude: ^lib/contrib/ additional_dependencies: - flake8-absolute-import==1.0.0.1 - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.23.1 + rev: v8.31.0 hooks: - id: eslint args: [--quiet] - repo: https://github.com/keewis/blackdoc - rev: v0.3.7 + rev: v0.3.8 hooks: - id: blackdoc args: ["-l", "78"] @@ -73,11 +73,11 @@ repos: args: [--allow-option-flag, IGNORE_EXCEPTION_MODULE_IN_PYTHON2] exclude: ^doc/.* - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.8.0.4 + rev: v0.9.0.2 hooks: - id: shellcheck - repo: https://github.com/codespell-project/codespell - rev: v2.2.1 + rev: v2.2.2 hooks: - id: codespell files: ^doc/.*\.rst$ diff --git a/cronscripts/publishing/cron.base-ppa.sh b/cronscripts/publishing/cron.base-ppa.sh index 0065021..e663fac 100644 --- a/cronscripts/publishing/cron.base-ppa.sh +++ b/cronscripts/publishing/cron.base-ppa.sh @@ -15,8 +15,10 @@ if [ "$LOCKFILEOPTIONS" == "" ]; then LOCKFILEOPTIONS="-r1" fi -# Claim the lockfile. -if ! lockfile $LOCKFILEOPTIONS $LOCKFILE; then +# Claim the lockfile. ($LOCKFILEOPTIONS is deliberately unquoted, since it +# may expand to either zero words or one word.) +# shellcheck disable=SC2086 +if ! lockfile $LOCKFILEOPTIONS "$LOCKFILE"; then echo "Could not claim lock file." exit 1 fi diff --git a/lib/lp/app/browser/doc/menu.rst b/lib/lp/app/browser/doc/menu.rst index d50a767..8b24ff5 100644 --- a/lib/lp/app/browser/doc/menu.rst +++ b/lib/lp/app/browser/doc/menu.rst @@ -45,6 +45,7 @@ are usually bound to a view. ... ... # A hack that reveals secret of how facets work. ... __launchpad_facetname__ = "overview" + ... # Menus are normally registered using the menu ZCML directive. >>> provideAdapter( diff --git a/lib/lp/app/browser/doc/watermark.rst b/lib/lp/app/browser/doc/watermark.rst index 7746f59..37ea3f7 100644 --- a/lib/lp/app/browser/doc/watermark.rst +++ b/lib/lp/app/browser/doc/watermark.rst @@ -123,5 +123,6 @@ for the context and the heading is rendered in H1. >>> @implementer(IMajorHeadingView) ... class HeadingView(TrivialView): ... pass + ... >>> print(get_hierarchy(widget, viewcls=HeadingView).heading()) <h1...><a...>Widget</a></h1> diff --git a/lib/lp/app/browser/tests/test_launchpadform_doc.py b/lib/lp/app/browser/tests/test_launchpadform_doc.py index 15293e2..5e679ab 100644 --- a/lib/lp/app/browser/tests/test_launchpadform_doc.py +++ b/lib/lp/app/browser/tests/test_launchpadform_doc.py @@ -118,6 +118,7 @@ def doctest_custom_widget_with_setUpFields_override(): ... ... def setRenderedValue(self, value): ... self.value = value + ... >>> class CustomView(LaunchpadFormView): ... custom_widget_my_bool = CustomStubWidget ... diff --git a/lib/lp/app/doc/badges.rst b/lib/lp/app/doc/badges.rst index f48f84a..0bee5ae 100644 --- a/lib/lp/app/doc/badges.rst +++ b/lib/lp/app/doc/badges.rst @@ -197,6 +197,7 @@ determination methods to use the results of an alternative query. ... def blueprints(self): ... print("Foo.blueprints") ... return [] + ... Now define the adapter for the Foo content class. @@ -271,6 +272,7 @@ branches in the batch and that is used to construct the DecoratedBranch. ... ... def isBlueprintBadgeVisible(self): ... return False + ... >>> delegating_foo = DelegatingFoo(foo) >>> delegating_foo diff --git a/lib/lp/app/doc/hierarchical-menu.rst b/lib/lp/app/doc/hierarchical-menu.rst index 29915ba..fdf7f7b 100644 --- a/lib/lp/app/doc/hierarchical-menu.rst +++ b/lib/lp/app/doc/hierarchical-menu.rst @@ -38,6 +38,7 @@ First, we need a hierarchy of objects to build upon: ... self.path = name ... self.inside = parent ... self.rootsite = None + ... >>> class Root(BaseContent): ... """The site root.""" @@ -46,14 +47,17 @@ First, we need a hierarchy of objects to build upon: >>> @implementer(ICookbook) ... class Cookbook(BaseContent): ... pass + ... >>> @implementer(IRecipe) ... class Recipe(BaseContent): ... pass + ... >>> @implementer(ICooker) ... class Cooker(BaseContent): ... pass + ... Today we'll be cooking with Spam! diff --git a/lib/lp/app/doc/launchpadform.rst b/lib/lp/app/doc/launchpadform.rst index 345b6bc..996ec23 100644 --- a/lib/lp/app/doc/launchpadform.rst +++ b/lib/lp/app/doc/launchpadform.rst @@ -61,6 +61,7 @@ example schema: ... name = "fred" ... displayname = "Fred" ... password = "password" + ... A form that handles all fields in the schema needs only set the diff --git a/lib/lp/app/doc/launchpadformharness.rst b/lib/lp/app/doc/launchpadformharness.rst index 91e0c7d..ab1165c 100644 --- a/lib/lp/app/doc/launchpadformharness.rst +++ b/lib/lp/app/doc/launchpadformharness.rst @@ -20,6 +20,7 @@ To demonstrate its use we'll create a sample schema and view class: ... class HarnessTest: ... string = None ... number = 0 + ... >>> class HarnessTestView(LaunchpadFormView): ... schema = IHarnessTest diff --git a/lib/lp/app/doc/menus.rst b/lib/lp/app/doc/menus.rst index 10f0bba..3534dba 100644 --- a/lib/lp/app/doc/menus.rst +++ b/lib/lp/app/doc/menus.rst @@ -55,6 +55,7 @@ for traversable objects. ... self.path = name ... self.inside = parent ... self.rootsite = None + ... >>> class Root(BaseContent): ... """The root of 'cookery', a vhost and facet.""" @@ -63,10 +64,12 @@ for traversable objects. >>> @implementer(ICookbook) ... class Cookbook(BaseContent): ... pass + ... >>> @implementer(IRecipe) ... class Recipe(BaseContent): ... pass + ... Content views associates with menus @@ -124,14 +127,17 @@ content object's menu. >>> @implementer(IRecipeEditMenuMarker) ... class RecipeEditInstructionsView(LaunchpadView): ... """View for editing recipe instructions on the cookery facet.""" + ... >>> @implementer(IRecipeEditMenuMarker) ... class RecipeEditIngredientsView(LaunchpadView): ... """View for editing recipe ingedients on the cookery facet.""" + ... >>> @implementer(IRecipeJournalMenuMarker) ... class RecipeReadJournalView(LaunchpadView): ... """View for reading a recipe's journal on the cookery facet.""" + ... >>> class RecipeQuestionsAllView(LaunchpadView): ... """View for all questions of a recipe on the questions facet.""" @@ -1085,6 +1091,7 @@ that the comment refers to. >>> @implementer(IComment) ... class Comment(BaseContent): ... pass + ... # This is usually done in ZCML by browser:defaultView. diff --git a/lib/lp/app/doc/tales.rst b/lib/lp/app/doc/tales.rst index 99bfb3e..eb27ee5 100644 --- a/lib/lp/app/doc/tales.rst +++ b/lib/lp/app/doc/tales.rst @@ -1466,6 +1466,7 @@ Test the 'fmt:url' namespace for canonical urls. ... path = "bonobo/saki" ... inside = None ... rootsite = None + ... >>> object_having_url = ObjectThatHasUrl() >>> print(test_tales("foo/fmt:url", foo=object_having_url)) diff --git a/lib/lp/archiveuploader/tests/static-translations.rst b/lib/lp/archiveuploader/tests/static-translations.rst index f6f2e99..a1be2b6 100644 --- a/lib/lp/archiveuploader/tests/static-translations.rst +++ b/lib/lp/archiveuploader/tests/static-translations.rst @@ -41,6 +41,7 @@ publishing behaviour using a mock PackageUploadCustom object: ... self.customformat = ( ... PackageUploadCustomFormat.STATIC_TRANSLATIONS ... ) + ... >>> bat = getUtility(IDistributionSet)["ubuntu"]["breezy-autotest"] diff --git a/lib/lp/bugs/doc/checkwatches.rst b/lib/lp/bugs/doc/checkwatches.rst index 036044d..47205b8 100644 --- a/lib/lp/bugs/doc/checkwatches.rst +++ b/lib/lp/bugs/doc/checkwatches.rst @@ -74,6 +74,7 @@ require no action from the Launchpad end. ... body=socket.timeout("Connection timed out."), ... ) ... yield + ... >>> with CaptureOops() as capture, timeout_requests(): ... updater = CheckwatchesMaster(transaction.manager) diff --git a/lib/lp/bugs/doc/externalbugtracker-bug-imports.rst b/lib/lp/bugs/doc/externalbugtracker-bug-imports.rst index cd79b89..574e139 100644 --- a/lib/lp/bugs/doc/externalbugtracker-bug-imports.rst +++ b/lib/lp/bugs/doc/externalbugtracker-bug-imports.rst @@ -26,6 +26,7 @@ methods. ... ... def getBugTargetName(self, remote_bug): ... return self._bugs[remote_bug]["package"] + ... >>> from lp.bugs.interfaces.bugtracker import BugTrackerType >>> from lp.registry.interfaces.distribution import IDistributionSet diff --git a/lib/lp/bugs/doc/externalbugtracker-comment-imports.rst b/lib/lp/bugs/doc/externalbugtracker-comment-imports.rst index dee5c8b..257c3d8 100644 --- a/lib/lp/bugs/doc/externalbugtracker-comment-imports.rst +++ b/lib/lp/bugs/doc/externalbugtracker-comment-imports.rst @@ -83,6 +83,7 @@ ExternalBugTracker class which implements these three methods. ... rfc822msgid=comment_id, ... ) ... return message + ... >>> external_bugtracker = CommentImportingExternalBugTracker( ... "http://example.com/" diff --git a/lib/lp/bugs/doc/externalbugtracker-comment-pushing.rst b/lib/lp/bugs/doc/externalbugtracker-comment-pushing.rst index 4fa71bf..56c1374 100644 --- a/lib/lp/bugs/doc/externalbugtracker-comment-pushing.rst +++ b/lib/lp/bugs/doc/externalbugtracker-comment-pushing.rst @@ -74,6 +74,7 @@ ISupportsCommentPushing interface. ... ... self.next_comment_id += 1 ... return remote_comment_id + ... >>> external_bugtracker = CommentPushingExternalBugTracker( ... "http://example.com/" diff --git a/lib/lp/bugs/doc/externalbugtracker-linking-back.rst b/lib/lp/bugs/doc/externalbugtracker-linking-back.rst index e724a15..0b16fcc 100644 --- a/lib/lp/bugs/doc/externalbugtracker-linking-back.rst +++ b/lib/lp/bugs/doc/externalbugtracker-linking-back.rst @@ -25,6 +25,7 @@ about the bug. ... ): ... self.last_launchpad_bug_id = launchpad_bug_id ... print("Setting Launchpad id for bug %s" % remote_bug) + ... The methods are called by the CheckwatchesMaster class: diff --git a/lib/lp/bugs/doc/externalbugtracker.rst b/lib/lp/bugs/doc/externalbugtracker.rst index 48206a5..94164ef 100644 --- a/lib/lp/bugs/doc/externalbugtracker.rst +++ b/lib/lp/bugs/doc/externalbugtracker.rst @@ -437,6 +437,7 @@ logged saying that comments won't be imported. ... class CommentImportExternalBugTracker(TimeUnknownExternalBugTracker): ... baseurl = "http://whatever.com" ... sync_comments = True + ... >>> checkwatches_master = CheckwatchesMaster( ... transaction, syncable_gnome_products=[], logger=FakeLogger() diff --git a/lib/lp/buildmaster/doc/buildfarmjobbehaviour.rst b/lib/lp/buildmaster/doc/buildfarmjobbehaviour.rst index 6395a46..a7979b5 100644 --- a/lib/lp/buildmaster/doc/buildfarmjobbehaviour.rst +++ b/lib/lp/buildmaster/doc/buildfarmjobbehaviour.rst @@ -35,6 +35,7 @@ methods as well. ... ... def dispatchBuildToWorker(self, logger): ... print("Did something special to dispatch MySpecialBuild.") + ... For this documentation, we'll also need a dummy new build farm job. @@ -45,6 +46,7 @@ For this documentation, we'll also need a dummy new build farm job. >>> @implementer(IMyNewBuildFarmJob) ... class MyNewBuildFarmJob: ... pass + ... Custom behaviours are not normally instantiated directly, instead an adapter is specified for the specific IBuildFarmJob. Normally we'd add some ZCML to diff --git a/lib/lp/registry/doc/hasowner-authorization.rst b/lib/lp/registry/doc/hasowner-authorization.rst index f0733bf..77e0119 100644 --- a/lib/lp/registry/doc/hasowner-authorization.rst +++ b/lib/lp/registry/doc/hasowner-authorization.rst @@ -15,6 +15,7 @@ itself or a Launchpad admin. >>> @implementer(IHasOwner) ... class FooObject: ... owner = salgado + ... Salgado is the owner of any FooObject we create, so he can edit it. diff --git a/lib/lp/registry/tests/person_from_principal.rst b/lib/lp/registry/tests/person_from_principal.rst index 5a6c1e5..9f729e0 100644 --- a/lib/lp/registry/tests/person_from_principal.rst +++ b/lib/lp/registry/tests/person_from_principal.rst @@ -27,6 +27,7 @@ time we adapt. ... class LaunchpadPrincipal: ... ... person = cached_person + ... >>> person_from_principal(LaunchpadPrincipal()) is cached_person True diff --git a/lib/lp/services/doc/looptuner.rst b/lib/lp/services/doc/looptuner.rst index 2168338..2ce1f95 100644 --- a/lib/lp/services/doc/looptuner.rst +++ b/lib/lp/services/doc/looptuner.rst @@ -87,6 +87,7 @@ architectures, compilers used for the Python interpreter, etc. ... self.last_chunk_size = chunk_size ... self.clock += self.timings[self.iteration] ... self.iteration += 1 + ... In combination with that, we tweak LoopTuner to simulate the timings we gave @@ -218,6 +219,7 @@ This variant of the LoopTuner simulates an overridable cost function: ... ... def computeCost(self): ... return self.cost_function(self.last_chunk_size) + ... >>> class CostedTuner(LoopTuner): @@ -424,6 +426,7 @@ of the actual run-time. ... def __call__(self, chunk_size): ... print("Processing %d items." % (chunk_size)) ... self.iteration += 1 + ... Aim for a low goal_seconds (to reduce test runtime), and only 3 iterations. diff --git a/lib/lp/services/fields/doc/uri-field.rst b/lib/lp/services/fields/doc/uri-field.rst index fc08dfd..4bdaf90 100644 --- a/lib/lp/services/fields/doc/uri-field.rst +++ b/lib/lp/services/fields/doc/uri-field.rst @@ -209,6 +209,7 @@ This widget is registered as an input widget: >>> @implementer(IURIFieldTest) ... class URIFieldTest: ... field = None + ... >>> context = URIFieldTest() >>> field = IURIFieldTest["field"].bind(context) diff --git a/lib/lp/services/mail/tests/incomingmail.rst b/lib/lp/services/mail/tests/incomingmail.rst index aa92a98..7d68ac9 100644 --- a/lib/lp/services/mail/tests/incomingmail.rst +++ b/lib/lp/services/mail/tests/incomingmail.rst @@ -37,6 +37,7 @@ handle, and register them for some domains: ... def process(self, mail, to_addr, filealias): ... self.handledMails.append(mail["Message-Id"]) ... return True + ... >>> from lp.services.mail.handlers import mail_handlers >>> foo_handler = MockHandler() @@ -257,6 +258,7 @@ attempting to process incoming mail. ... ... def process(self, mail, to_addr, filealias): ... raise TestOopsException() + ... >>> mail_handlers.add("oops.com", OopsHandler()) And submit an email to the handler. @@ -371,6 +373,7 @@ reporting in the web interface, are not ignored in the email interface. ... class UnauthorizedOopsHandler: ... def process(self, mail, to_addr, filealias): ... raise Unauthorized() + ... >>> mail_handlers.add("unauthorized.com", UnauthorizedOopsHandler()) >>> msg = email.message_from_string( @@ -434,6 +437,7 @@ Let's create and register a handler which raises a SQL error: ... def process(self, mail, to_addr, filealias): ... cur = cursor() ... cur.execute("SELECT 1/0") + ... >>> mail_handlers.add("except.com", DBExceptionRaiser()) Now we send a mail to the handler, which will cause an exception: diff --git a/lib/lp/services/webapp/doc/canonical_url.rst b/lib/lp/services/webapp/doc/canonical_url.rst index 33bec16..32123e4 100644 --- a/lib/lp/services/webapp/doc/canonical_url.rst +++ b/lib/lp/services/webapp/doc/canonical_url.rst @@ -96,17 +96,20 @@ interfaces. First, we create some countryset, country and town objects. >>> @implementer(ICountrySet) ... class CountrySet: ... pass + ... >>> countryset_instance = CountrySet() >>> @implementer(ICountry) ... class Country: ... name = "England" + ... >>> country_instance = Country() >>> @implementer(ITown) ... class Town: ... country = country_instance ... name = "London" + ... >>> town_instance = Town() Next, we check there are no ICanonicalUrlData adapters for these objects. @@ -231,6 +234,7 @@ an adapter. ... @property ... def inside(self): ... return getUtility(ILaunchpadRoot) + ... The CountrySetUrl class needs to be accessible from zcml. So, we put it in our temporary module. @@ -322,6 +326,7 @@ ICanonicalUrlData, but its parent or its parent's parent (and so on) cannot. ... def __init__(self, name, parent): ... self.path = name ... self.inside = parent + ... >>> unrooted_object = ObjectThatHasUrl("unrooted", object_that_has_no_url) >>> canonical_url(unrooted_object) Traceback (most recent call last): @@ -418,6 +423,7 @@ zope.publisher.interfaces.http.IHTTPApplicationRequest. ... ), "this is not a real IHTTPApplicationRequest" ... assert not path_only, "not a real IHTTPApplicationRequest" ... return self.applicationurl + ... >>> mandrill_request = FakeRequest("https://mandrill.example.org:23") >>> print(canonical_url(country_instance)) diff --git a/lib/lp/services/webapp/doc/canonicalurl.rst b/lib/lp/services/webapp/doc/canonicalurl.rst index fdb0d4e..803a590 100644 --- a/lib/lp/services/webapp/doc/canonicalurl.rst +++ b/lib/lp/services/webapp/doc/canonicalurl.rst @@ -29,6 +29,7 @@ First, we'll construct an example object hierarchy. ... self.path = name ... self.inside = parent ... self.rootsite = None + ... >>> class Root(BaseContent): ... pass @@ -37,10 +38,12 @@ First, we'll construct an example object hierarchy. >>> @implementer(ICookbook) ... class Cookbook(BaseContent): ... pass + ... >>> @implementer(IRecipe) ... class Recipe(BaseContent): ... pass + ... Here is the structure of our hierarchy: @@ -62,6 +65,7 @@ We'll try adapting our objects to a made-up interface, ICookingDirections. ... class CookingDirections: ... def __init__(self, context): ... self.context = context + ... Right now, none of our example objects can be turned into cooking directions. @@ -137,6 +141,7 @@ First we need a named adapter to use: ... class LabelledCookbook: ... def __init__(self, context): ... self.context = context + ... >>> provideAdapter( ... LabelledCookbook, [ICookbook], ILabelledCookbook, name="foo" diff --git a/lib/lp/services/webapp/doc/menus.rst b/lib/lp/services/webapp/doc/menus.rst index ca89778..f11fad5 100644 --- a/lib/lp/services/webapp/doc/menus.rst +++ b/lib/lp/services/webapp/doc/menus.rst @@ -27,6 +27,7 @@ Construct an example url hierarchy ... self.path = name # See ICanonicalUrlData. ... self.inside = parent # See ICanonicalUrlData. ... self.rootsite = None # See ICanonicalUrlData. + ... Here's a useful class that we can use to effectively register adapters for an object, without actually using adapter registries. This comes @@ -351,6 +352,7 @@ Next, we return the link as HTML. ... class InteractiveTestRequest(LaunchpadTestRequest): ... principal = None ... interaction = None + ... >>> request = InteractiveTestRequest() >>> login(ANONYMOUS, request) @@ -647,6 +649,7 @@ object. >>> @implementer(IThingHavingFacets) ... class SomeThing: ... pass + ... >>> something_with_facets = SomeThing() >>> IFacetMenu(something_with_facets, None) is None True @@ -657,6 +660,7 @@ We also need to check that we have no IApplicationMenu adapter named >>> @implementer(IThingHavingMenus) ... class SomeOtherThing: ... pass + ... >>> something_with_menus = SomeOtherThing() >>> print(queryAdapter(something_with_menus, IApplicationMenu, "foo")) None @@ -761,6 +765,7 @@ link should appear linked. The request is also set as the menu's ... ... def setPrincipal(self, principal): ... self.principal = principal + ... >>> request = FakeRequest("http://launchpad.test/sesamestreet/+bar") >>> view = LaunchpadView(house, request) >>> view.__launchpad_facetname__ = "bar" diff --git a/lib/lp/services/webapp/doc/navigation.rst b/lib/lp/services/webapp/doc/navigation.rst index e751322..2cf30a4 100644 --- a/lib/lp/services/webapp/doc/navigation.rst +++ b/lib/lp/services/webapp/doc/navigation.rst @@ -134,6 +134,7 @@ interface, we'll define one here. ... return self.query_string ... else: ... return None + ... >>> request = Request() @@ -149,6 +150,7 @@ interface, we'll define one here. ... ... def __repr__(self): ... return "<Thing '%s'>" % self.value + ... >>> @implementer(IThingSet) ... class ThingSet: @@ -160,6 +162,7 @@ interface, we'll define one here. ... ... def __repr__(self): ... return "<ThingSet>" + ... >>> thingset = ThingSet() diff --git a/lib/lp/services/webapp/doc/timeout.rst b/lib/lp/services/webapp/doc/timeout.rst index 917871c..2e14f71 100644 --- a/lib/lp/services/webapp/doc/timeout.rst +++ b/lib/lp/services/webapp/doc/timeout.rst @@ -66,6 +66,7 @@ Same thing if a function decorated using @with_timeout is called. >>> @with_timeout() ... def wait_a_little(): ... time.sleep(1) + ... >>> wait_a_little() Traceback (most recent call last): ... @@ -79,6 +80,7 @@ successfully. >>> @with_timeout(timeout=2) ... def wait_a_little_more(): ... time.sleep(1) + ... >>> wait_a_little_more() >>> def _timeout(): @@ -87,6 +89,7 @@ successfully. >>> @with_timeout(timeout=_timeout) ... def wait_a_little_again(): ... time.sleep(1) + ... >>> wait_a_little_again() >>> class Foo: diff --git a/lib/lp/services/webapp/doc/zcmldirectives.rst b/lib/lp/services/webapp/doc/zcmldirectives.rst index e6bf83d..49e5434 100644 --- a/lib/lp/services/webapp/doc/zcmldirectives.rst +++ b/lib/lp/services/webapp/doc/zcmldirectives.rst @@ -60,10 +60,12 @@ default view for the IFooLayer layer. >>> @implementer(IFoo) ... class FooObject: ... pass + ... >>> fooobject = FooObject() >>> @implementer(IFooLayer) ... class Request: ... pass + ... >>> request = Request() >>> class FooView: diff --git a/lib/lp/services/webservice/doc/webservice-configuration.rst b/lib/lp/services/webservice/doc/webservice-configuration.rst index b3e3099..07480ea 100644 --- a/lib/lp/services/webservice/doc/webservice-configuration.rst +++ b/lib/lp/services/webservice/doc/webservice-configuration.rst @@ -35,6 +35,7 @@ developer. >>> @implementer(ILaunchBag) ... class FakeLaunchBag: ... developer = False + ... >>> the_launchbag = FakeLaunchBag() >>> provideUtility(the_launchbag, ILaunchBag) diff --git a/lib/lp/testing/tests/test_pages.py b/lib/lp/testing/tests/test_pages.py index 8b33e63..d819d62 100644 --- a/lib/lp/testing/tests/test_pages.py +++ b/lib/lp/testing/tests/test_pages.py @@ -30,10 +30,10 @@ class TestMakeStoryTest(unittest.TestCase): def test_dir_construction_and_trivial_running(self): test_filename = os.path.join(self.tempdir, "xx-foo.rst") - test_file = open(test_filename, "wt") + test_file = open(test_filename, "w") test_file.close() test_filename = os.path.join(self.tempdir, "xx-bar.rst") - test_file = open(test_filename, "wt") + test_file = open(test_filename, "w") test_file.close() # The test directory is looked up relative to the calling # module's path. diff --git a/utilities/rocketfuel-setup b/utilities/rocketfuel-setup index 3021e1b..2fd9679 100755 --- a/utilities/rocketfuel-setup +++ b/utilities/rocketfuel-setup @@ -117,11 +117,11 @@ for key in $REQUIRED_PPA_KEYS; do if ! sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 \ apt-key adv --list-keys --with-colons --fingerprint | grep -qE "^fpr:+$key"; then echo "Retrieving key $key." - if ! gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $key; then + if ! gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$key"; then echo "Could not retrieve key $key." exit 1 fi - if ! gpg --export -a $key | sudo apt-key add -; then + if ! gpg --export -a "$key" | sudo apt-key add -; then echo "Could not install key $key." exit 1 fi
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp

