<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/openstack/python-cinderclient.git/cinderclient/tests/unit/test_shell.py, branch master</title>
<subtitle>opendev.org: openstack/python-cinderclient.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/'/>
<entry>
<title>Merge "Move print operations to shell_utils"</title>
<updated>2023-01-26T18:13:28+00:00</updated>
<author>
<name>Zuul</name>
<email>zuul@review.opendev.org</email>
</author>
<published>2023-01-26T18:13:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=6579899d3aedfaf041850c10904c9e4769809c20'/>
<id>6579899d3aedfaf041850c10904c9e4769809c20</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Python3.11: fix crashes in ShellTest</title>
<updated>2022-12-21T13:31:33+00:00</updated>
<author>
<name>Cyril Roelandt</name>
<email>cyril@redhat.com</email>
</author>
<published>2022-07-28T18:14:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=20506ef3a8b5fb1b7a9b0a2c31dbe5f60eea2130'/>
<id>20506ef3a8b5fb1b7a9b0a2c31dbe5f60eea2130</id>
<content type='text'>
In Python3.11, global flags must be placed right at the start of a
regular expression.

The following regex:

	r'.*?(?m)^Lists all volumes.',
must become:

        r'(?m).*?^Lists all volumes.',

However, since we are using re.MULTILINE, we actually do not need to use
a global flag.

This commit fixes the following tests in Python3.11:
- cinderclient.tests.unit.test_shell.ShellTest.test_help_arg_no_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand_mv

Closes-Bug: #1983047
Change-Id: If20abef109ddd7107c83b5886beb666a6550a640
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In Python3.11, global flags must be placed right at the start of a
regular expression.

The following regex:

	r'.*?(?m)^Lists all volumes.',
must become:

        r'(?m).*?^Lists all volumes.',

However, since we are using re.MULTILINE, we actually do not need to use
a global flag.

This commit fixes the following tests in Python3.11:
- cinderclient.tests.unit.test_shell.ShellTest.test_help_arg_no_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand_mv

Closes-Bug: #1983047
Change-Id: If20abef109ddd7107c83b5886beb666a6550a640
</pre>
</div>
</content>
</entry>
<entry>
<title>Move print operations to shell_utils</title>
<updated>2022-11-15T15:12:41+00:00</updated>
<author>
<name>Eric Harney</name>
<email>eharney@redhat.com</email>
</author>
<published>2022-11-09T17:28:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=2d7ae2cd38a2194f98b71d4d98c4273e9ad33e72'/>
<id>2d7ae2cd38a2194f98b71d4d98c4273e9ad33e72</id>
<content type='text'>
Move more code to shell_utils that is only used
for shell operations.

The benefit of this is that the cinderclient library
becomes lighter-weight, because users of the lib
no longer have to import prettytable and extra code.

Change-Id: I7bf6bd91ee5746d1ad4bd4504f3a056d03ae86a9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move more code to shell_utils that is only used
for shell operations.

The benefit of this is that the cinderclient library
becomes lighter-weight, because users of the lib
no longer have to import prettytable and extra code.

Change-Id: I7bf6bd91ee5746d1ad4bd4504f3a056d03ae86a9
</pre>
</div>
</content>
</entry>
<entry>
<title>Python3.11: Fix argparse-related test failures</title>
<updated>2022-07-28T19:46:35+00:00</updated>
<author>
<name>Cyril Roelandt</name>
<email>cyril@redhat.com</email>
</author>
<published>2022-07-28T18:48:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=90eb9d2be62b5eef179edc7d5ab2cb424a6119e0'/>
<id>90eb9d2be62b5eef179edc7d5ab2cb424a6119e0</id>
<content type='text'>
In Python3.11, the following code crashes:

$ cat test.py
import argparse

parser = argparse.ArgumentParser(description='Short sample app')
subparsers = parser.add_subparsers()
subparsers.add_parser('foo')
subparsers.add_parser('foo')

$ python3.11 test.py
Traceback (most recent call last):
  File "/tmp/arg.py", line 6, in &lt;module&gt;
    subparsers.add_parser('foo')
  File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument {foo}: conflicting subparser: foo

It is now forbidden to use add_parser() multiple times with the same
arguments, which is exactly what we do in the following tests:

- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions
- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args

In order to fix the tests failures, we make sure to reset the parser and
subparsers before calling add_parser().

While not strictly necessary, we split those tests into two functions,
for readability purposes.

Closes-Bug: #1983054
Change-Id: I2d4cb81a394f3c10e5f01945d894746a904fb5df
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In Python3.11, the following code crashes:

$ cat test.py
import argparse

parser = argparse.ArgumentParser(description='Short sample app')
subparsers = parser.add_subparsers()
subparsers.add_parser('foo')
subparsers.add_parser('foo')

$ python3.11 test.py
Traceback (most recent call last):
  File "/tmp/arg.py", line 6, in &lt;module&gt;
    subparsers.add_parser('foo')
  File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser
    raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument {foo}: conflicting subparser: foo

It is now forbidden to use add_parser() multiple times with the same
arguments, which is exactly what we do in the following tests:

- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions
- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args

In order to fix the tests failures, we make sure to reset the parser and
subparsers before calling add_parser().

While not strictly necessary, we split those tests into two functions,
for readability purposes.

Closes-Bug: #1983054
Change-Id: I2d4cb81a394f3c10e5f01945d894746a904fb5df
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove v2 support from the shell</title>
<updated>2021-07-13T03:04:09+00:00</updated>
<author>
<name>Brian Rosmaita</name>
<email>rosmaita.fossdev@gmail.com</email>
</author>
<published>2021-05-17T22:34:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=3502a5591a654ae57741c6738994ffa9d8457696'/>
<id>3502a5591a654ae57741c6738994ffa9d8457696</id>
<content type='text'>
Also removes the v2 support from the generic client and restores a
skipped test.

Additionally, the cinderclient.tests.v2.test_availablity_zone module
depends on the v2.shell class, so move that module to v3, update the
v3 AvailablityZone class, and make appropriate adjustments to the
tests and test fixtures.

Change-Id: I7a3cca15f5944141d510a75af6684221c297963b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also removes the v2 support from the generic client and restores a
skipped test.

Additionally, the cinderclient.tests.v2.test_availablity_zone module
depends on the v2.shell class, so move that module to v3, update the
v3 AvailablityZone class, and make appropriate adjustments to the
tests and test fixtures.

Change-Id: I7a3cca15f5944141d510a75af6684221c297963b
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove all usage of six library</title>
<updated>2021-03-04T08:03:35+00:00</updated>
<author>
<name>haixin</name>
<email>haixin@inspur.com</email>
</author>
<published>2020-09-30T02:40:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=cea1f674ae1ce545c0cac209b423ac9d626f0c68'/>
<id>cea1f674ae1ce545c0cac209b423ac9d626f0c68</id>
<content type='text'>
Replace six with Python 3 style code.

Change-Id: I4b97e040f3e790ac114dcd43c68e6b67b1079adf
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace six with Python 3 style code.

Change-Id: I4b97e040f3e790ac114dcd43c68e6b67b1079adf
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix undesirable raw Python error</title>
<updated>2020-10-29T15:09:26+00:00</updated>
<author>
<name>Eduardo Santos</name>
<email>eduardo.experimental@gmail.com</email>
</author>
<published>2020-10-23T14:17:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=d92f15a09e59942bb60b7ef3a81c1e21dc16b578'/>
<id>d92f15a09e59942bb60b7ef3a81c1e21dc16b578</id>
<content type='text'>
Using the cinderclient without a subcommand while
passing an optional argument triggers the raw Python
error `ERROR: 'Namespace' object has no attribute
'func'`. This bug can be reproduced by issuing the
command `cinder --os-volume-api-version 3.40`.
Added a default value to `func` and an empty value to
`command` as placeholders so that a help message is
shown instead of the Python error.

Change-Id: Idb51e8635b97f0da2976f3268d5e19100ec77203
Closes-Bug: #1867061
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Using the cinderclient without a subcommand while
passing an optional argument triggers the raw Python
error `ERROR: 'Namespace' object has no attribute
'func'`. This bug can be reproduced by issuing the
command `cinder --os-volume-api-version 3.40`.
Added a default value to `func` and an empty value to
`command` as placeholders so that a help message is
shown instead of the Python error.

Change-Id: Idb51e8635b97f0da2976f3268d5e19100ec77203
Closes-Bug: #1867061
</pre>
</div>
</content>
</entry>
<entry>
<title>Use unittest.mock instead of third party mock</title>
<updated>2020-06-05T14:52:09+00:00</updated>
<author>
<name>Sean McGinnis</name>
<email>sean.mcginnis@gmail.com</email>
</author>
<published>2020-04-18T16:57:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=4e24fd614be8e7aae82224f0add044e3d62c8b51'/>
<id>4e24fd614be8e7aae82224f0add044e3d62c8b51</id>
<content type='text'>
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Ia41326a601dfd72750bd81c3ebee9ec5884ad91b
Signed-off-by: Sean McGinnis &lt;sean.mcginnis@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Ia41326a601dfd72750bd81c3ebee9ec5884ad91b
Signed-off-by: Sean McGinnis &lt;sean.mcginnis@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Pass os_endpoint to keystone session</title>
<updated>2020-03-24T07:39:11+00:00</updated>
<author>
<name>Ian Wienand</name>
<email>iwienand@redhat.com</email>
</author>
<published>2020-03-24T04:24:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=38a44e7ebeead6c086374d80f25d135618380faa'/>
<id>38a44e7ebeead6c086374d80f25d135618380faa</id>
<content type='text'>
The os_endpoint should be passed to the keystone session as the
endpoint_override argument.

This is particularly imprtant for talking to Rackspace, who seem to
have an odd situation where the endpoint is V2 compatible [1], but the
API is still at /v1/ [2] (i think?).

To use the RAX API you need to find your account number, then
something like:

 OS_USERNAME=xyz
 OS_PASSWORD=abc
 OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
 OS_VOLUME_API_VERSION=2
 CINDER_ENDPOINT=https://dfw.blockstorage.api.rackspacecloud.com/v1/&lt;account#&gt;
 cinder volume list

Should work

Honestly I'm not 100% what's up with the unit test.  I think endpoint
override was not being processed previously, and now it is so it drops
the "admin"?

Story: #2007459
Task: #39138

[1] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/cbsv1-methods-vs-cinderv2-methods/
[2] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/service-access/

Change-Id: I6b9a1f088c84676ddf9894cf9524d3239f3cf3a9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The os_endpoint should be passed to the keystone session as the
endpoint_override argument.

This is particularly imprtant for talking to Rackspace, who seem to
have an odd situation where the endpoint is V2 compatible [1], but the
API is still at /v1/ [2] (i think?).

To use the RAX API you need to find your account number, then
something like:

 OS_USERNAME=xyz
 OS_PASSWORD=abc
 OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
 OS_VOLUME_API_VERSION=2
 CINDER_ENDPOINT=https://dfw.blockstorage.api.rackspacecloud.com/v1/&lt;account#&gt;
 cinder volume list

Should work

Honestly I'm not 100% what's up with the unit test.  I think endpoint
override was not being processed previously, and now it is so it drops
the "admin"?

Story: #2007459
Task: #39138

[1] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/cbsv1-methods-vs-cinderv2-methods/
[2] https://developer.rackspace.com/docs/cloud-block-storage/v1/general-api-info/service-access/

Change-Id: I6b9a1f088c84676ddf9894cf9524d3239f3cf3a9
</pre>
</div>
</content>
</entry>
<entry>
<title>Raise hacking version to 2.0.0</title>
<updated>2019-12-21T09:27:48+00:00</updated>
<author>
<name>Sean McGinnis</name>
<email>sean.mcginnis@gmail.com</email>
</author>
<published>2019-12-21T09:27:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/openstack/python-cinderclient.git/commit/?id=ced267b1d5d92237f456a5e8907534ded5324d28'/>
<id>ced267b1d5d92237f456a5e8907534ded5324d28</id>
<content type='text'>
We've kept hacking capped for a long time now. This raises the hacking
package version to the latest release and fixes the issues that it
found.

Change-Id: I69e41a340c815090f25677607e971a8e75791f6d
Signed-off-by: Sean McGinnis &lt;sean.mcginnis@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We've kept hacking capped for a long time now. This raises the hacking
package version to the latest release and fixes the issues that it
found.

Change-Id: I69e41a340c815090f25677607e971a8e75791f6d
Signed-off-by: Sean McGinnis &lt;sean.mcginnis@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
