[outreachy][cinder] Unable to generate api-ref samples for snapshot transfer

Brian Rosmaita rosmaita.fossdev at gmail.com
Fri Apr 7 13:49:58 UTC 2023


Hi Toheeb.  Thanks for working on this!

On 4/6/23 5:09 PM, Toheeb Oyekola wrote:
> Hi,
> 
> I am trying to generate api-ref doc from template by running "tox -e 
> snaphot_transfer" but I keep getting the same error pasted in the link 
> https://paste.openstack.org/show/bFPbWKQAKRbIds4R0wWn 
> <https://paste.openstack.org/show/bFPbWKQAKRbIds4R0wWn>
> and I have installed the missing dependency as shown below, anyone have 
> an Idea what the issue could have been?

There are two reasons you might be seeing the ModuleNotFoundError:
1 - dependency missing
2 - you have the dependency, but the module isn't in that version

What you're seeing is #2.  SQLAlchemy 2.0 doesn't contain the 
sqlalchemy.databases module:

[master] wha'ppen? .tox/venv/bin/pip freeze | grep -i sqlalchemy==
SQLAlchemy==2.0.9
[master] wha'ppen? .tox/venv/bin/python
Python 3.10.10 ...
 >>> from sqlalchemy.databases import sqlite as sa_base
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sqlalchemy.databases'
 >>>

But this module does exist in SQLAlchemy 1.4:

[master] wha'ppen? .tox/py310/bin/pip freeze | grep -i sqlalchemy==
SQLAlchemy==1.4.41
[master] wha'ppen? .tox/py310/bin/python
Python 3.10.10 ...
 >>> from sqlalchemy.databases import sqlite as sa_base
 >>>

The cinder tox.ini file uses upper-constraints to force tox to install 
the appropriate versions of dependencies.  Right now, that's 
SQLAlchemy===1.4.41, which you can see if you search this file:

https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt

The cinder tox.ini file uses upper constraints here:

https://opendev.org/openstack/cinder/src/commit/42ef47ba26ab15c526afa7eec7f243bd1c97f770/tox.ini#L58

I think what may be happening in your case is that you've set up a 
custom tox testenv named 'snapshot_transfer' and it is using the tox 
default install_command, that doesn't constrain dependencies, and so 
you're winding up with SQLAlchemy 2.0.  Make sure that it contains this 
line from the "regular" api-samples testenv:

https://opendev.org/openstack/cinder/src/commit/42ef47ba26ab15c526afa7eec7f243bd1c97f770/tox.ini#L71

By the way, if you just want to run your new snapshot_transfers tests, 
you can use the "regular" api-samples testenv like this:

tox -e api-samples -- api_sample_tests.test_snapshots

That runs all the tests in 
cinder/tests/functional/api_sample_tests/test_snapshots.py ; just adjust 
it to the name of your file containing the snapshot transfers tests.


Or you may be doing all this stuff already and the problem may be 
something else entirely.

> 
> Thanks for your time.
> 
> 
> 
> image.png




More information about the openstack-discuss mailing list