This is an automated email from the ASF dual-hosted git repository.
kgiusti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 713d46f DISPATCH-1455: not testing mutually exclusive groups on rhel6.
new 4399ca8 Merge pull request #597 from
nicob87/nb-rhel6-argparse-fixing-tests
713d46f is described below
commit 713d46f9f9c283ed995b5eda03fc2097dcfa5349
Author: Nicolas Brignone <[email protected]>
AuthorDate: Mon Oct 21 17:14:31 2019 -0300
DISPATCH-1455: not testing mutually exclusive groups on rhel6.
---
python/qpid_dispatch_internal/tools/command.py | 3 ++
tests/system_tests_edge_router.py | 45 +++++++++++++-------------
tests/test_command.py | 12 +++++--
3 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/python/qpid_dispatch_internal/tools/command.py
b/python/qpid_dispatch_internal/tools/command.py
index 2b4ae81..76aab73 100644
--- a/python/qpid_dispatch_internal/tools/command.py
+++ b/python/qpid_dispatch_internal/tools/command.py
@@ -34,6 +34,9 @@ from qpid_dispatch_site import VERSION
from proton import SSLDomain, Url
from proton.utils import SyncRequestResponse, BlockingConnection
+def version_supports_mutually_exclusive_arguments():
+ return sys.version_info >= (2,7)
+
class UsageError(Exception):
"""
Raise this exception to indicate the usage message should be printed.
diff --git a/tests/system_tests_edge_router.py
b/tests/system_tests_edge_router.py
index 84d56e2..3165cf2 100644
--- a/tests/system_tests_edge_router.py
+++ b/tests/system_tests_edge_router.py
@@ -39,10 +39,10 @@ from proton.handlers import MessagingHandler
from proton.reactor import Container, DynamicNodeProperties
from proton.utils import BlockingConnection
from qpid_dispatch.management.client import Node
+from qpid_dispatch_internal.tools.command import
version_supports_mutually_exclusive_arguments
from subprocess import PIPE, STDOUT
import re
-
class AddrTimer(object):
def __init__(self, parent):
self.parent = parent
@@ -1307,17 +1307,6 @@ class RouterTest(TestCase):
self.assertEqual(outs.count("INT.A"), 5)
self.assertEqual(outs.count("INT.B"), 5)
- has_error = False
- try:
- # You cannot combine --all-entities with -c
- outs = self.run_qdstat(['-c', '--all-entities'],
- address=self.routers[0].addresses[0])
- except Exception as e:
- if "error: argument --all-entities: not allowed with argument
-c/--connections" in str(e):
- has_error=True
-
- self.assertTrue(has_error)
-
outs = self.run_qdstat(['-c', '--all-routers'],
address=self.routers[0].addresses[0])
self.assertEqual(outs.count("INT.A"), 2)
@@ -1329,16 +1318,6 @@ class RouterTest(TestCase):
# Two edge-downlinks from each interior to the two edges, 4 in total.
self.assertEqual(outs.count("edge-downlink"), 4)
- has_error = False
- try:
- outs = self.run_qdstat(['-r', 'INT.A', '--all-routers'],
- address=self.routers[0].addresses[0])
- except Exception as e:
- if "error: argument --all-routers: not allowed with argument
-r/--router" in str(e):
- has_error=True
-
- self.assertTrue(has_error)
-
# Gets all entity information of the interior router
outs = self.run_qdstat(['--all-entities'],
address=self.routers[0].addresses[0])
@@ -1349,6 +1328,28 @@ class RouterTest(TestCase):
self.assertEqual(outs.count("Router Statistics"), 1)
self.assertEqual(outs.count("Link Routes"), 2)
+ if version_supports_mutually_exclusive_arguments():
+ has_error = False
+ try:
+ # You cannot combine --all-entities with -c
+ outs = self.run_qdstat(['-c', '--all-entities'],
+ address=self.routers[0].addresses[0])
+ except Exception as e:
+ if "error: argument --all-entities: not allowed with argument
-c/--connections" in str(e):
+ has_error=True
+
+ self.assertTrue(has_error)
+
+ has_error = False
+ try:
+ outs = self.run_qdstat(['-r', 'INT.A', '--all-routers'],
+ address=self.routers[0].addresses[0])
+ except Exception as e:
+ if "error: argument --all-routers: not allowed with argument
-r/--router" in str(e):
+ has_error=True
+
+ self.assertTrue(has_error)
+
class LinkRouteProxyTest(TestCase):
"""
diff --git a/tests/test_command.py b/tests/test_command.py
index 85ea935..c364b01 100644
--- a/tests/test_command.py
+++ b/tests/test_command.py
@@ -17,7 +17,7 @@
# under the License.
#
-import unittest, argparse, sys
+import argparse, sys
from itertools import combinations
from qpid_dispatch_internal.tools.command import (main,
@@ -25,7 +25,10 @@ from qpid_dispatch_internal.tools.command import (main,
parse_args_qdstat,
parse_args_qdmanage,
_qdmanage_parser,
- _qdstat_parser)
+ _qdstat_parser,
+
version_supports_mutually_exclusive_arguments)
+
+from system_test import unittest
def mock_error(self, message):
raise ValueError(message)
@@ -57,6 +60,11 @@ class TestParseArgsQdstat(unittest.TestCase):
self.parser.print_help()
def test_parse_args_qdstat_mutually_exclusive(self):
+ if not version_supports_mutually_exclusive_arguments():
+ #unittest.skip also not supported
+ print("skipping: Mutually_exclusive options not working on python
2.6")
+ return
+
options1 = ["-g", "-c",
"-l","-n","-e","-a","-m","--autolinks","--linkroutes","--log",
"--all-entities"]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]