[Twisted-Python] Twisted 15.0 Release Announcement

2015-01-30 Thread HawkOwl
Hi everyone!

On behalf of Twisted Matrix Laboratories, I am honoured to announce that 
Twisted 15.0.0 is *here*!

Highlights are:

- SSLv3 is disabled by default by endpoints created by 
`twisted.internet.endpoints.serverFromString` and 
`twisted.internet.endpoints.clientFromString`.
- inlineCallbacks now has introductory documentation, and now supports using 
the return statement with a value on Python 3.
- `twisted.web.client.Agent` now supports using UNIX sockets.
- `ProcessEndpoint` now has flow control, which makes it useful for many more 
protocols
- A whole bunch of bug fixes and other improvements, with 70+ closed tickets.

You can find the downloads at  (or 
alternatively ). The full details 
of what’s new in the release is contained in the NEWS file 
.

As usual, many thanks to everyone who had a part in this release - the 
supporters of the Twisted Software Foundation, the developers who contributed 
code and documentation, and all the people building great things with Twisted!

Twisted Regards,
HawkOwl


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] bringing TxMongo back from the brink!

2015-01-30 Thread bret curtis
On Fri, Jan 30, 2015 at 4:19 AM, Glyph  wrote:

>
>
> On Jan 29, 2015, at 12:05 PM, Clayton Daley 
> wrote:
>
> Unless Twisted loves the idea of hosting this, it might make more sense to
> start a TxCommons (like https://github.com/ZF-Commons). This shifts the
> emphasis away from the Twisted and onto the Commons, including:
>
>- The lower (or lack of) "core support" commitment.  The Commons can
>still highlight "supported" projects (by the commons or outside
>organizations), but it's more transparent about the status relative to 
> core.
>- A significantly lower participation/contribution barrier that isn't
>interrelated with the politics (and justifiably high standards) of core.
>- A central place to find Tx libraries that actively welcomes new
>additions.
>   - My twisted-pyro and twisted-mandrill are so-so examples of what I
>   mean.  If they were a little more mature, it'd be better for someone to
>   find and improve these libraries than start over from scratch.
>   - More importantly, users would know that the project won't
>   fragment if I'm not proactively maintaining it. They can always become 
> an
>   active participant in the Commons and move business along.  Obviously, I
>   relinquish that control if and when I contribute it (or the commons
>   establishes an official fork).
>
> Clayton Daley
>
>
> So, I don't mind the idea of Twisted hosting it for now, but you make a
> good point.  The Twisted org on Github is presently hosting quite a few
> things, with varying degrees of association with various subsets of the
> core developers.
>
> Since ldaptor already moved to this org, I think we should probably just
> move this as well, and then move things *out* later once we have
> established a Commons org and figured out how we want to administer it.
>
> BTW: any chance of renaming those TxPyro and TxMandrill? :)
>
> -glyph
>
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>

If ever the Twisted org on github feels a bit crowded, I think a break out
to something like TxCommons is a good idea.

Cheers,
Bret
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Unit testing, trail, inlineCallbacks, deferreds and mocking

2015-01-30 Thread Patryk Ściborek
Hi James,

Thank you for Your response, it was very helpful :) I hope you don't mind
if I use your testing.py in my project. I wrote tests for the
SessionCleaner class and they seems to be OK (
https://github.com/scibi/pyradacctsrv/blob/master/tests/test_cleaner.py).

I saw your post from July 2013 but that thread was more about docstrings
and checking return values of test methods than mocking and deferreds ;)

Kind regards,
Patryk

On Tue, Jan 27, 2015 at 3:48 PM, James Broadhead 
wrote:

> Hey
>
> I raised a similar question a while ago:
> http://twistedmatrix.com/pipermail/twisted-python/2013-July/027241.html
>
> Since then, our approach has evolved into the below, which may be useful.
>
> https://github.com/jamesbroadhead/bttrtwisted/blob/master/bttrtwisted/testing.py
>
> Usage:
>   expected = Foo()
>   remote_result = Result()
>   thing = Thing()
>   thing.call_external_service = dmockfunc(remote_result)
>
>   d = thing.function_under_test(..)
>   d.addCallback(self.assertEqual, expected)
>   return d
>
> You can use the func_dict param to gen_nondeferred_mock to have it stand
> in-place-of an object
>
> As always with mocks, a little can be helpful, but if you find you're
> instantiating a lot of them, you may want to reconsider your approach.
>
> Feedback welcome!
> [ the repo is for experiments, so use with care ]
>
> James
>
> On 27 January 2015 at 13:00, Patryk Ściborek  wrote:
>
>> Hi!
>>
>> I've just started a new project using Twisted and I want to write unit
>> tests since the beginning. Unfortunately I've got some trouble
>> understanding how should I do it. I read 'Test-driven development with
>> Twisted', read some articles on the web and searched on the mailing list
>> but I couldn't find anything which make it clear for me.
>>
>> I've got a class:
>>
>> class SessionCleaner(object):
>> def __init__(self, session_db, interval=10):
>> self.session_db = session_db
>> self.lc = task.LoopingCall(self.check_old_sessions)
>> self.lc.start(interval)
>>
>> @defer.inlineCallbacks
>> def check_old_sessions(self):
>> log.msg('check_old_sessions()', logLevel=logging.DEBUG)
>> try:
>> old_sessions = yield self.session_db.get_old_sessions()
>> for s in old_sessions:
>> yield self.session_db.process_stopped(s)
>>
>> except txredisapi.ConnectionError as e:
>> log.msg('check_old_sessions - connection error {}'
>> .format(e), logLevel=logging.WARNING)
>>
>> session_db is a object with methods which makes some calls to Redis.
>>
>> Testing if __init__ works correctly is easy - I can mock task.LoopingCall
>> and check if it was called with correct attributes.
>>
>> I've got trouble testing check_old_sessions. Since I'm writing unit tests
>> I don't want to call real session_db methods and make real Redis queries.
>> I'd like to mock them and test just few things:
>> - is the method get_old_sessions called?
>> - is the method process_stopped called N times with the arguments
>> returned by mocked get_old_sessions?
>> - is txredisapi.ConnectionError handled correctly?
>>
>> So is there any "right" way of mocking functions which returns deferreds?
>> Or maybe I should test this method differently?
>>
>> Best regards,
>> Patryk
>>
>> ___
>> Twisted-Python mailing list
>> Twisted-Python@twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>>
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python