Hi all. Without much ado here's my status report for June...
* Stem: Migrated to the Mock module
Our homemade mocking framework has served us well, but over time it taught me one very important lesson: writing a mocking framework is hard. On the surface it seems pretty simple: apply and revert a set of monkey patches. But how do you monkey patch class methods? What about alias imports like the os module? And god forbid you want to mock python's open() function.
I'm finally taking a lesson from one of my coworkers and using a library for this. Python has several options but the most common is PyPI's mock module, which became part of the standard library in Python 3.3...
http://www.voidspace.org.uk/python/mock/ https://gitweb.torproject.org/stem.git/commitdiff/101cf0b?hp=65846e8
========================================
* Arm: Pruning the torTools utility
Arm's torTools module was a wrapper around TorCtl that provided caching, thread safety, and a better API. Now that we're using stem it's obsolete, and my aim is to completely eliminate it from the codebase. This is easier said than done however. This month I pruned vast swaths of the module, reducing it from 2768 lines to 1020...
before: https://gitweb.torproject.org/arm.git/blob/refs/heads/release:/src/util/torT... after: https://gitweb.torproject.org/arm.git/blob/HEAD:/src/util/torTools.py
Doing this required some expansions on stem's part. Added functionality includes...
* get_pid() and get_user() methods in the Controller * system functions for getting a process' start time and FreeBSD jail path * the system module's call() wasn't respecting exit codes
========================================
* Stem: Remote descriptor fetching
Throughout the month Karsten and I have been bouncing ideas back and fourth concerning a stem API for remote descriptor fetching...
https://trac.torproject.org/projects/tor/wiki/doc/stem#RemoteDescriptorFetch... https://lists.torproject.org/pipermail/tor-dev/2013-June/004957.html
I have some s3krit ideas for improving this that will address both our use cases even better (spoiler: future style instances). We're coming up on a four day weekend so hopefully I'll be able to start implementing this soon!
========================================
* Stem: Expanded FAQ with answers to common Stack Overflow questions
I took a pass over the tor related questions on Stack Overflow (http://stackoverflow.com/questions/tagged/tor), answering fifteen that concerned controller scripting. The vast majority of those unfortunately were some variation of 'how do I programmatically change my IP?' which I answered with a Stem FAQ entry...
https://stem.torproject.org/faq.html#how-do-i-request-a-new-identity-from-to...
The only question I thought was especially interesting went along the lines of 'How do I check the IPs of the exits I'm presently using?'. I answered this with a FAQ entry too...
http://stackoverflow.com/questions/9777192/how-do-i-get-the-tor-exit-node-ip... https://stem.torproject.org/faq.html#how-do-i-get-information-about-my-exits
========================================
... and a handful of smaller tasks...
* Investigated the descriptor version provided via tor's 'GETINFO ns/*' options. Contrary to to the spec it turns out these have been v3 all along, and stem now parses them as such. (#7953) * Our automated Jenkins test runs caught their first instance of tor regression. This concerned LOADCONF's behavior after merging a branch for ticket #6752 (#9122). * Handful of GSoC tasks (welcome/sorry emails after acceptance was announced, and org admin prep for the program's start) * Added msg_type argument to ControlMessage.from_str() (request by meejah, #8605) * Investigated cache consistency issue (thanks to Ravi, #7713) * Fixes for ONLINE target (patch by Jeremy, #8692) * Minor revisions to how consensus bandwidth-weights are validated (#6872) * Addressed an arm issue with certain TERMs (#9064) * Answered some questions from Sreenatha that came up while migrating Tor Weather to Stem (https://lists.torproject.org/pipermail/tor-dev/2013-June/005035.html)
Cheers! -Damian