Some folks call this the "Don't Break the Build" practice.
But what does that mean for Python where there is no build? And what does it mean for a solo developer where there aren't any consequences?
The No-Build Build
The C++, Java, C# folks all have a really important, multi-step daily build. The code has to compile; it has to be packaged into JAR's (or DLL's or whatever). Perhaps higher-level packages like WAR's or EAR's need to be built. Then you can run unit tests.
We Python folks don't have anything between code and unit test -- there's no real packaging. This makes the daily build practice seem a little silly.
However, the daily "commit and run all the tests" is perhaps more important in Python than it is in Java (or C++ or C#.) Even without any actual build activity, the daily build is still an essential practice.
Things Go Wrong
In Python, you've got two fundamental things which a daily check-in will spot.
- Bugs. All of the logic errors that a daily unit test will spot.
- Bad Refactoring. This is more subtle. Not all refactoring errors lead directly to a bug that you can detect. Indeed, there are a significant refactoring problem that I fight with weekly.
No Sense of Commitment
Refactoring is central to Agile development. It is inevitable that you realize that you've misnamed, misplaced or overused some module or package and need to either rename it or delete it.
In Python, you've got to use `grep` (or something similar) to check your application for a clean change in names. And you've got to double-check by using SVN to delete or rename the module.
Adding a new module, however, is more subtle. Adding a new module is easy and quick. You write it, you use it, you unit test and you're good to go.
Except, of course, if you forget to check it into SVN. If it's not in SVN, it will still pass all your local unit tests. It's those "daily build" unit tests that will break on a missing module.
VM To The Rescue
Solo developers, of course, have trouble with the nightly build. First, they can skip it. Second, and more important for folks saddled with Windows, you don't often have a clean QA user separate from you, the developer.
A VM is a very, very nice thing to have. You fire up VMWare (or similar player) and run your daily build in a separate machine. For a solo developer, you can do the following:
- Make changes, unit test.
- Commit the changes.
- Fire up the VM. Do an SVN UP. Run the unit tests again.
When a Python app crashes and burns on the VM, 80% of the time, it's a missing commit. The rest of the time it's a failed configuration change for any differences between development and QA.
Now you can -- confidently -- turn code over to a sysadmin, knowing that it actually will work.