Merge lp://staging/~barry/lazr.delegates/lp1096513 into lp://staging/lazr.delegates
Proposed by
Barry Warsaw
Status: | Merged |
---|---|
Merged at revision: | 7 |
Proposed branch: | lp://staging/~barry/lazr.delegates/lp1096513 |
Merge into: | lp://staging/lazr.delegates |
Diff against target: |
2350 lines (+1248/-848) 28 files modified
.bzrignore (+2/-0) HACKING.rst (+16/-2) MANIFEST.in (+3/-4) _bootstrap/COPYRIGHT.txt (+0/-9) _bootstrap/LICENSE.txt (+0/-54) _bootstrap/bootstrap.py (+0/-77) buildout.cfg (+0/-31) distribute_setup.py (+546/-0) ez_setup.py (+0/-241) lazr/__init__.py (+12/-8) lazr/delegates/NEWS.rst (+6/-0) lazr/delegates/__init__.py (+15/-6) lazr/delegates/_delegates.py (+9/-37) lazr/delegates/_passthrough.py (+55/-0) lazr/delegates/_python2.py (+38/-0) lazr/delegates/_python3.py (+38/-0) lazr/delegates/docs/fixture.py (+34/-0) lazr/delegates/docs/usage.rst (+136/-0) lazr/delegates/docs/usage_fixture.py (+27/-0) lazr/delegates/tests/__init__.py (+0/-16) lazr/delegates/tests/test_api.py (+35/-0) lazr/delegates/tests/test_passthrough.py (+85/-0) lazr/delegates/tests/test_python2.py (+166/-0) lazr/delegates/version.txt (+1/-1) setup.cfg (+9/-0) setup.py (+15/-19) src/lazr/delegates/README.txt (+0/-292) src/lazr/delegates/tests/test_docs.py (+0/-51) |
To merge this branch: | bzr merge lp://staging/~barry/lazr.delegates/lp1096513 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella | Approve | ||
Curtis Hovey | Pending | ||
Gary Poster | Pending | ||
Review via email: mp+142052@code.staging.launchpad.net |
Description of the change
See bug for API changes and more details.
To post a comment you must log in.
On Jan 07, 2013, at 11:02 AM, Gavin Panella wrote:
>Review: Approve
>
>Looks good. Some minor points. I did a fairly quick once-over
>sanity-check rather than an in-depth review, so you might want to ask
>someone else to take a look if you think it warrants it.
Thanks for the review! You caught some great things.
I'll see if Gary or Curtis wants to take a look, otherwise I'll JFDI :).
BTW, what did you think of @delegate_to as the choice of name?
>+def delegate_ to(*interfaces, **kws):
>+ context = kws.pop('context', 'context')
>+ if len(kws) > 0:
>+ raise TypeError('Too many arguments')
>+ def _decorator(cls):
>+ if len(interfaces) == 0:
>+ raise TypeError('At least one interface is required')
>
>I think it would make more sense to check interfaces at the same time
>as kws, i.e. in delegate_to, rather than _decorator.
>
>In both _python2.py and python3.py.
Good idea, fixed.
>--- lazr/delegates/ docs/fixture. py 1970-01-01 00:00:00 +0000 docs/fixture. py 2013-01-07 10:44:28 +0000 delegates/ docs/usage_ fixture. py too.
>+++ lazr/delegates/
>@@ -0,0 +1,34 @@
>+# Copyright 2009-2013 Canonical Ltd. All rights reserved.
>+#
>+# This file is part of lazr.smtptest
>
>s/smtptest/
>
>In lazr/delegates/
Fixed everywhere.
>+The ``@delegation`` decorator makes a class implement zero or more interfaces delegate_ to/
>
>s/delegation/
Fixed.
>=== added file 'lazr/delegates /docs/usage_ fixture. py' docs.fixture import globs
>...
>+__all__ = [
>+ 'globs',
>+ ]
>+
>+
>+from lazr.delegates.
>
>What does this module do?
It's a nosetests artifact. AFAICT, under nose (which is generally pretty
awesome) the only way to add a fixture for a doctest is to provide a suffix
which is appended to the doctest base name. So, given "_fixture" as the
suffix, for usage.rst it will only search for usage_fixture.py.
In lazr.delegates case, that's not a big deal, but I copied this over from doc.fixture, and then import what's needed into
lazr.smtptest (which I'm porting to Python 3 in a very similar way) and it has
more than one doctest. So the idea was to put the common fixtures in a shared
module, e.g. lazr.delegates.
the nose-required module name.
BTW, I opened a bug on nose for making this nicer.
https:/ /github. com/nose- devs/nose/ issues/ 594
>+class TestAPI( unittest. TestCase) : interfaces( self): 'TypeError expected')
>+ """Test various corner cases in the API."""
>+
>+ def test_no_
>+ try:
>+ @delegate_to()
>+ class SomeClass(object):
>+ pass
>+ except TypeError:
>+ pass
>+ else:
>+ raise AssertionError(
>
>assertRaises would be more concise, but I can see that there's some
>clarity here from using decorator syntax. Use self.fail() instead of
>`raise AssertionError`?
Yeah, I did it this way to use the syntax that you'd see more commonly in the
code. Good idea about self.fail() though - fixed!
Update pushed, and again, thanks!
Would you take a quick look at the lazr.smtptest mp? /code.launchpad .net/~barry/ lazr.smtptest/ lp1096475
https:/