On Tue, Apr 27, 2010 at 5:16 PM, Barry Warsaw
<barry@python.org> wrote:
>> 2) have unit tests that fail before the patch and succeed after
>
>This list would make a good addition to one of the cpython development
>pages. If potential contributors could find this information, then
>they'd be much more likely to participate by doing reviews.
It would be kind of cool if there were some best practices for running said
unittest both with and without the patch enabled. Kind of like using #ifdefs
in C but without all the commenting-out-commenting-in error proneness. I
guess you could do something like
if os.getenv('BUG1234'):
# Patch the frobnicator to not bloviate.
When I'm writing the patch it's usually easy, I write the tests, see that they fail, write the fix, see that they pass.
When I'm reviewing the patch, I apply the patch, see that the tests pass, svn revert the fix, check that they fail.
Most of the patches affect just a couple of files, so applying the whole patch and then revert is usually trivial and probably easier than having to deal with two separate files for patch and tests.