Thiago F. Pappacena has proposed merging ~pappacena/turnip:scenario-tests into 
turnip:master.

Commit message:
Test scenario to ensure compatibility with both v1 and v2 git protocols

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Even when a git client announces that it wants to use v2 protocol, the git 
server can announce that it's not compatible with v2 and the client falls back 
to v1. So, it should be safe to have our test suite running tests for both v1 
and v2 on all frontends, and we implement v2 compatibility as separated steps.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
~pappacena/turnip:scenario-tests into turnip:master.
diff --git a/requirements.txt b/requirements.txt
index 89895ea..4c5f050 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -39,7 +39,7 @@ mock==3.0.5; python_version < "3"
 pathlib2==2.3.5
 Paste==2.0.2
 PasteDeploy==2.1.0
-pbr==5.4.4
+pbr==5.4.5
 pep8==1.5.7
 psutil==5.7.0
 pyasn1==0.4.8
@@ -60,7 +60,8 @@ scandir==1.10.0
 setuptools-scm==1.17.0
 simplejson==3.6.5
 six==1.14.0
-testtools==2.3.0
+testscenarios-0.5.0
+testtools==2.4.0
 traceback2==1.4.0
 translationstring==1.3
 Twisted[conch]==20.3.0
diff --git a/setup.py b/setup.py
index 76bf6c2..44507da 100755
--- a/setup.py
+++ b/setup.py
@@ -37,6 +37,7 @@ test_requires = [
     'fixtures',
     'flake8',
     'mock; python_version < "3"',
+    'testscenarios',
     'testtools',
     'webtest',
     ]
diff --git a/turnip/pack/tests/test_functional.py b/turnip/pack/tests/test_functional.py
index d6aaa7f..27bc26e 100644
--- a/turnip/pack/tests/test_functional.py
+++ b/turnip/pack/tests/test_functional.py
@@ -35,6 +35,7 @@ from fixtures import (
     TempDir,
     )
 from pygit2 import GIT_OID_HEX_ZERO
+from testscenarios.testcase import WithScenarios
 from testtools import TestCase
 from testtools.content import text_content
 from testtools.deferredruntest import AsynchronousDeferredRunTest
@@ -77,10 +78,15 @@ from turnip.pack.tests.fake_servers import (
 from turnip.version_info import version_info
 
 
-class FunctionalTestMixin(object):
+class FunctionalTestMixin(WithScenarios):
 
     run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
 
+    scenarios = [
+        ('v1 protocol', {"protocol_version": b"1"}),
+        ('v2 protocol', {"protocol_version": b"2"}),
+        ]
+
     def startVirtInfo(self):
         # Set up a fake virt information XML-RPC server which just
         # maps paths to their SHA-256 hash.
@@ -120,6 +126,11 @@ class FunctionalTestMixin(object):
 
     @defer.inlineCallbacks
     def assertCommandSuccess(self, command, path='.'):
+        if command[0] == b'git':
+            args = list(command[1:])
+            command = [
+                b'git', b'-c', b'protocol.version=%s' % self.protocol_version
+            ] + args
         out, err, code = yield utils.getProcessOutputAndValue(
             command[0], command[1:], env=os.environ, path=path)
         if code != 0:
@@ -130,6 +141,11 @@ class FunctionalTestMixin(object):
 
     @defer.inlineCallbacks
     def assertCommandFailure(self, command, path='.'):
+        if command[0] == b'git':
+            args = list(command[1:])
+            command = [
+                b'git', b'-c', b'protocol.version=%s' % self.protocol_version
+            ] + args
         out, err, code = yield utils.getProcessOutputAndValue(
             command[0], command[1:], env=os.environ, path=path)
         if code == 0:
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to