test.helper: shutil.rmtree workaround for Windows

On Windows, shutil.rmtree() raises an exception if it tries to remove a
file marked as read-only.  The files that git creates in the
.git/objects directory are read-only, so the GitRepositoryTestCase hits
this problem when shutil.rmtree() is called during tearDown.  Work
around the issue by passing a an onerror handler to shutil.rmtree()
which detects the case of trying to remove a read-only file, changes the
file to be writeable, and tries again to remove it.

Signed-off-by: Daniel Harding <dharding@living180.net>
test: make tests portable to Windows

Using os.system() to shell out to perform various test setup functions
does not work well on Windows because it uses different shell syntax.
To address this, remove the shell() method from TmpPathTestCase, along
with the shell() and pipe() functions from the test.helper module.  To
facilitate replacing usages of the shell() method, add three static
methods to TmpPathTestCase:

 * touch(): creates one or more empty files if they do not already
   exist.
 * write_file(): sets the content of file at the specified path
 * append_file(): appends content to the file at the specified path

In addition, add a git() method to GitRepositoryTestCase, which uses
subprocess to invoke git with the specified arguments and returns any
output generated by git.

Re-implement all the uses of the shell() method or the pipe() function
using these helper methods or built-in Python functions.

Signed-off-by: Daniel Harding <dharding@living180.net>
test.git_test: skip test not supported on Windows

test_it_handles_interrupted_syscalls uses signal.SIGALRM, which is not
supported on Windows, so skip this test case on Windows.

Signed-off-by: Daniel Harding <dharding@living180.net>
Merge pull request #332 from living180/test_portability

Make tests portable to Windows

Signed-off-by: David Aguilar <davvid@gmail.com>