43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From 972aff0f329caf3343038349ebe86b5d039ca6ab Mon Sep 17 00:00:00 2001
|
|
From: Felipe Reyes <felipe.reyes@canonical.com>
|
|
Date: Fri, 25 Mar 2022 09:46:20 -0300
|
|
Subject: [PATCH] Fix test_help_on_subcommand on Python 3.10
|
|
|
|
Python 3.10 changed the way the optional arguments defined in argparse
|
|
are listed in the help output, the title was changed from "Optional
|
|
arguments" to "Options".
|
|
|
|
This checks the python version where the unit test is being executed and
|
|
uses the string that corresponds.
|
|
|
|
Story: 2009946
|
|
Task: 44858
|
|
Change-Id: Ibee09bf76399849f7da987c4661fa1945d27afb7
|
|
---
|
|
magnumclient/tests/test_shell.py | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/magnumclient/tests/test_shell.py b/magnumclient/tests/test_shell.py
|
|
index c4b8b8d..fb1d209 100644
|
|
--- a/magnumclient/tests/test_shell.py
|
|
+++ b/magnumclient/tests/test_shell.py
|
|
@@ -119,9 +119,13 @@ class ShellTest(utils.TestCase):
|
|
def test_help_on_subcommand(self):
|
|
required = [
|
|
'.*?^usage: magnum bay-create',
|
|
- '.*?^Create a bay.',
|
|
- '.*?^Optional arguments:',
|
|
+ '.*?^Create a bay.'
|
|
]
|
|
+ # https://bugs.python.org/issue9694
|
|
+ if sys.version_info[:2] >= (3, 10):
|
|
+ required.append('.*?^Options:')
|
|
+ else:
|
|
+ required.append('.*?^Optional arguments:')
|
|
stdout, stderr = self.shell('help bay-create')
|
|
for r in required:
|
|
self.assertThat((stdout + stderr),
|
|
--
|
|
2.36.1
|
|
|