08 October 2014 1 comment Python
Premailer is probably my most successful open source project in recent years. I base that on the fact that 25 different people have committed to it.
What it does is basically that it makes
premailer work in Python 3, PyPy and Python 2.6. Check out the tox.ini file. Test coverage is still 100%.
If you look at the patch the core of the change is actually surprisingly little. The majority of the "secret sauce" is basically a bunch of import statements which are split by
if sys.version_info >= (3, ): and some various minor changes around encoding UTF-8. The rest of the changes are basically test sit-ups.
A really interesting thing that hit us was that the code had assumptions about the order of things. Basically the tests assumed the the order of certain things in the resulting output was predictable even though it was done using a
s are famously unreliable in terms of the order you get things out and it's meant to be like that and it's a design choice. The reason it worked till now is not only luck but quite amazing.
Anyway, check it out. Now that we have a
tox.ini file it should become much easier to run tests which I hope means patches will be better checked as they come in.