D2950: tests: fix duplicate and failing test

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Apr 3 16:48:57 UTC 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG12bfc724217d: tests: fix duplicate and failing test (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2950?vs=7433&id=7547

REVISION DETAIL
  https://phab.mercurial-scm.org/D2950

AFFECTED FILES
  tests/test-wireproto-serverreactor.py

CHANGE DETAILS

diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py
--- a/tests/test-wireproto-serverreactor.py
+++ b/tests/test-wireproto-serverreactor.py
@@ -174,8 +174,8 @@
         ])
 
 class ServerReactorTests(unittest.TestCase):
-    def _sendsingleframe(self, reactor, s):
-        results = list(sendframes(reactor, [ffs(s)]))
+    def _sendsingleframe(self, reactor, f):
+        results = list(sendframes(reactor, [f]))
         self.assertEqual(len(results), 1)
 
         return results[0]
@@ -296,7 +296,7 @@
     def testunexpectedcommandargument(self):
         """Command argument frame when not running a command is an error."""
         result = self._sendsingleframe(makereactor(),
-                                       b'1 command-argument 0 ignored')
+                                       ffs(b'1 command-argument 0 ignored'))
         self.assertaction(result, 'error')
         self.assertEqual(result[1], {
             'message': b'expected command frame; got 2',
@@ -318,7 +318,7 @@
     def testunexpectedcommanddata(self):
         """Command argument frame when not running a command is an error."""
         result = self._sendsingleframe(makereactor(),
-                                       b'1 command-data 0 ignored')
+                                       ffs(b'1 command-data 0 ignored'))
         self.assertaction(result, 'error')
         self.assertEqual(result[1], {
             'message': b'expected command frame; got 3',
@@ -340,19 +340,32 @@
     def testmissingcommandframeflags(self):
         """Command name frame must have flags set."""
         result = self._sendsingleframe(makereactor(),
-                                       b'1 command-name 0 command')
+                                       ffs(b'1 command-name 0 command'))
         self.assertaction(result, 'error')
         self.assertEqual(result[1], {
             'message': b'missing frame flags on command frame',
         })
 
-    def testconflictingrequestid(self):
+    def testconflictingrequestidallowed(self):
         """Multiple fully serviced commands with same request ID is allowed."""
-        results = list(sendframes(makereactor(), [
-            ffs(b'1 command-name eos command'),
-            ffs(b'1 command-name eos command'),
-            ffs(b'1 command-name eos command'),
-        ]))
+        reactor = makereactor()
+        results = []
+        results.append(self._sendsingleframe(
+            reactor, ffs(b'1 command-name eos command')))
+        result = reactor.onbytesresponseready(1, b'response1')
+        self.assertaction(result, 'sendframes')
+        list(result[1]['framegen'])
+        results.append(self._sendsingleframe(
+            reactor, ffs(b'1 command-name eos command')))
+        result = reactor.onbytesresponseready(1, b'response2')
+        self.assertaction(result, 'sendframes')
+        list(result[1]['framegen'])
+        results.append(self._sendsingleframe(
+            reactor, ffs(b'1 command-name eos command')))
+        result = reactor.onbytesresponseready(1, b'response3')
+        self.assertaction(result, 'sendframes')
+        list(result[1]['framegen'])
+
         for i in range(3):
             self.assertaction(results[i], 'runcommand')
             self.assertEqual(results[i][1], {



To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list