Another GSOC Idea : a PyPI testing infrastructure
by Tarek Ziadé
Last year I’ve proposed a GSOC project that no student picked up. I think the fact that it was titled “A Distutils Regression System” was not really appealing. I should have called it a “PyPI testing infrastructure” because that’s what it is really. And I know today exactly how the system should work, so I can make a clearer proposal. The proposal page is here: http://wiki.python.org/moin/SummerOfCode/PyPITestingInfrastructure
So basically, the idea is to run a service that will receive update notifications everytime someone uploads a distribution at PyPI, to perform a few tests on it and send a report to the author by email (or display it on a website).
The tests we want to do are quite simple:
- does “python setup.py install” works or throw out some errors ?
- what files are modified on the system upon installation ?
- does the tests pass ?
For the latter, it supposes that we are able to detect and run the tests. They are no conventions yet (but the TIP list is working on this) but we can try out a few things on the source tree.
EDIT: for all the tests we want to run on a distribution, we should look at the CheeseCake project (Thanks Richard for mentioning it in the comments)
Getting update notifications is fairly simple now that Martin added a PubSubHubBub service at PyPI.
The core part of the project is to make sure the commands are run on a clean system. The easiest way to do it is to use Virtual Machines through a service like EC2: we can run the test, then rollback the VM state so it’s back in a clean state. There are a few libs in Python to drive systems like EC2. We also need to secure the VM so the code that is run doesn’t make network calls. If the project tests are relying on a network resource, those are bad tests anyways.
Last, but not least, if we want to get back interesting reports, we need to probe what’s going on. It’s simple at Python level, but we never know what can happen in a setup.py module. If a C module or an external program is called somehow in there, it could perform operations on the system we wouldn’t be aware of. I think SystemTap is a great tool to probe for all operations at the OS level. I am not sure how to do it under Win32 though..
But having a working story under Linux would be already a great thing, so I am not worrying about that at this point.
So, I’ve entered the topic in the GSOC list, and I am willing to mentor this if a student wants to do this. I know Titus is also very interested in this topic, so we might work together on this, as co-mentors, which would be great. That’s a topic we’ve discussed several times in the past and I think Titus wants a similar system. Mmm.. wait, we all do, don’t we ? 😉
That’s a lovely idea – can I add a feature request:
It would see if the module has any tests and if they do run them in coverage mode. The publisher would get back a report which would allow a simple assessment of whether the tests were sufficient to cover the published software.
Cheesecake did most of this, and more, didn’t it?
@Fod Fan Fo: Yeah, this would be good. We could also make it pluggable, so any QA test could be run.
@Richard: IIRC, cheesecake is only performing the testing part and they were no infrastructure created so it would be run in a safe/clean mode. I’ll add a reference to the project though, because we could reuse it in the testing part, definitely.
+1 I was complaining about it the other day: http://srid.nearfar.org/computing/buzz/crxprelease
Hi, Tarek
Richard is right — the Cheesecake project has tackled part of the issues you’re enumerating. I recently uploaded the Cheesecake code to BitBucket: http://bitbucket.org/griggheo/cheesecake/
Note that Michal Kwiatkowski, who worked on enhancements to Cheesecake during GSOC 2006, also wrote a so-called Cheesecake Service which used to grab the latest packages off of PyPI, run them through Cheesecake, and publish their score. It hasn’t been running for a while, but I’ll talk to Michal and I’ll try to revive it.
Michal also worked on another GSOC project in 2007 — it was called ‘Patch Verification System for Python”. Here is the summary:
“The goal of this project is to provide a straightforward way to test patches from the Python bug/patch tracker on SourceForge (soon to be migrated to Roundup). This system will test patches and generate reports automatically, giving feedback only a few minutes after patch submission. Both sides of the patching process will benefit — the patch submitter can find out and fix his mistakes much faster, while Python maintainers are given a solid base for a patch review. Once in place, the system will make the process of accepting patches less tedious and much more productive.”
Michal made a lot of progress, and he used VMWare at the time to fire up virtual instance where patches would be tested. His code could be used for your current proposal, I’m sure. I’ll talk to him about putting the code up on BitBucket.
I don’t see how to sandbox the call to ‘setup.py install’ to disallow network access, given that installing dependencies is going to require network access.
You should try following the redevelopment of cpan testers (2.0).
The CPAN needs no introduction, but they’ve been doing automated smoke testing for years. Really handy stuff for judging which modules will work for your project.
@Grig: Great ! thanks for the info. These are very similar projects indeed.
@Tres: You are right: we need to have a clever way to shutdown the network via firewall rules, allowing only accesses to pypi.python.org for instance.
@j_king: I’ve looked at the CPAN testers project but I didn’t know they had a redesign. I’ll digg deeper, thanks for the tip.
Python is too advanced for me.
[…] In March we started to develop Distutils2, which was basically the trunk of Distutils right before the Big Revert. Yannick and other fine folks from Montreal became regular contributors to the project. I’ve also started in March to think hard about my future, and found out I was really happy working remotely. I also started to focus on GSOC and build proposals for Distutils2 and other topics. […]