The Pyramid Sprint put on by Gocept in Halle, Germany was really well done. They combined this sprint and their companies own internal annual sprint with their yearly Garden Party that celebrates their anniversary of the company in grand style. We were well taken care of and managed to be productive and relax (the perfect combination at a sprint) at the same time. Much fun was had debating PEP8 and tools in the garden while we watched Chris McDonough carefully defend his opposition to trimming trailing white space.
I got there on Thursday evening just in time for the cookout on the first night, but the next day got down to business on Deform bugs. This was my first time working on the Pyramid (really Deform) code itself and it was amazingly easy to get going and understand what was happening in Deform.
Deform widgets and valid HTML5
I worked with Charlie Clark on fixing the Deform widgets to all validate as HTML5. What initially seemed like a trivial task quickly turned into much discussion about what standards to support and fixing many tests that would break along the way. Now Deform will output valid HTML which will benefit people using assistive devices and help with future compatibility with browsers.
Testing deformdemo with paster bootstrap
Along the way I got to play with some cool tools and learned quite a bit more about testing. For our tests we needed to actually call all of the templates generated by the deformdemo package and send them to a validator. This wasn't straightforward due to the need to have a fully bootstrapped WSGI environment to call the methods in the correct context. Luckily, Pyramid has a paster bootstrap method you can call like this:
from pyramid.paster import bootstrap
bs = bootstrap('demo.ini')
app = bs['app']
request = bs['request']
Calling it with the paster .ini file will then give you back a dictionary with things like the app and a request in it that can be used in the rest of the test. Now it is easy to call the method in the deformdemo to get all the demos. This returns a nice list of test names and URLs that we can now use with WebTest to actually simulate calling them and getting back the HTML that we will pass to the online HTML5 validator, Validator.nu. They have a nice web service that can return many different formats including plain text or JSON results for use by us later. You can see the example of this in the deformdemo validation tests.
Fixing the issues was actually quite easy once these tests showed us where the issues lived. After that, we updated the actual Deform tests and the deformdemo Selenium tests. Now any changes to the Deform widgets can be quickly validated.
Much work was done on many of the sub projects of the Pylons Project including Pyramid, Deform, Colander and Supervisor in addition to Gocept sprinting on many internal projects at the same time. See the wrap up wiki post by Gabrielle here that showcases some of the other work: https://github.com/Pylons/pyramid/wiki/Pyramid-and-Pylons-Project-Summer-Sprint-2013-Wrap-Up
Want to learn more about Pyramid?
- Learn about the Python Web Framework Pyramid and why we prefer it.
- Get notified by email when we publish blog posts, videos, and training about Pyramid.