Test + fix, I use this for working with vagrant vms that get rebuild regularly, so the host key entry changes each time.
LGTM - what do you think @Crispin Wellington
Michael, this test is not working for me on this branch:
Traceback (most recent call last):
File "/Users/andrew/Personal/hg-devel/other_parcels/parcel/vptest/lib/python2.7/site-packages/mock.py", line 1201, in patched
return func(*args, **keywargs)
File "/Users/andrew/Personal/hg-devel/other_parcels/parcel/tests/test_tools.py", line 137, in test_rsync
AssertionError: "rsync -av -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'" not found in <MagicMock name='rsync_local.calls_args.__getitem__().__getitem__()' id='4323003984'>
It might just be my setup though. Would you might double checking for me?
I encounter the same issue on ubuntu, the test worked on my other system.
It is possible to fix the test by adding a unicode prefix to the test string:
--- a/tests/test_tools.py Tue Oct 08 13:02:34 2013 +0200
+++ b/tests/test_tools.py Wed Nov 13 11:47:06 2013 +0100
@@ -132,9 +132,9 @@
# rsync command should specify ssh command
- self.assertIn("rsync -av -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'",
+ self.assertIn(u"rsync -av -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'",
# combine keyfile and port
with settings(key_filename="/some/path/to/a/keyfile.pub", port=3232):
but I first want to understand why this issue is specific to this test. I will update the pull request afterwards
Strange - a problem with assertIn I reckon - I see it is relatively new. It also won't work under 2.6.x so we might be better going back to
self.assert("x" in "xxxx")
I just found the real cause, it was a simple type calls_args -> call_args,
due to the MagickMock this call returned None instead of throwing an error.
I must have corrected the attribute while debugging the issue, sorry for the confusion.
The pull is updated with the fixed version.
Nice pick up - works fine for me now too :)