← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/turnip:test-protocol-v0 into turnip:master

 

Colin Watson has proposed merging ~cjwatson/turnip:test-protocol-v0 into turnip:master.

Commit message:
Test protocol version 0

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/turnip/+git/turnip/+merge/389837

This is what current versions of git use by default, so it makes sense to test it explicitly.  It's slightly different from protocol version 1, which added a version string in the initial response from the server.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/turnip:test-protocol-v0 into turnip:master.
diff --git a/turnip/pack/tests/test_functional.py b/turnip/pack/tests/test_functional.py
index 27bc26e..f33498d 100644
--- a/turnip/pack/tests/test_functional.py
+++ b/turnip/pack/tests/test_functional.py
@@ -83,6 +83,7 @@ class FunctionalTestMixin(WithScenarios):
     run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
 
     scenarios = [
+        ('v0 protocol', {}),
         ('v1 protocol', {"protocol_version": b"1"}),
         ('v2 protocol', {"protocol_version": b"2"}),
         ]
@@ -126,11 +127,12 @@ class FunctionalTestMixin(WithScenarios):
 
     @defer.inlineCallbacks
     def assertCommandSuccess(self, command, path='.'):
-        if command[0] == b'git':
+        if command[0] == b'git' and getattr(self, 'protocol_version', None):
             args = list(command[1:])
-            command = [
-                b'git', b'-c', b'protocol.version=%s' % self.protocol_version
-            ] + args
+            command = [b'git']
+            command.extend(
+                [b'-c', b'protocol.version=%s' % self.protocol_version])
+            command.extend(args)
         out, err, code = yield utils.getProcessOutputAndValue(
             command[0], command[1:], env=os.environ, path=path)
         if code != 0:
@@ -141,7 +143,7 @@ class FunctionalTestMixin(WithScenarios):
 
     @defer.inlineCallbacks
     def assertCommandFailure(self, command, path='.'):
-        if command[0] == b'git':
+        if command[0] == b'git' and getattr(self, 'protocol_version', None):
             args = list(command[1:])
             command = [
                 b'git', b'-c', b'protocol.version=%s' % self.protocol_version