无法运行OpenStack Nova的单元测试

1 投票
1 回答
1201 浏览
提问于 2025-04-18 01:12

我成功创建了一个虚拟环境,让nova可以运行单元测试。至少系统是这么说的。

Nova development environment setup is complete.
Nova development uses virtualenv to track and manage Python dependencies
while in development and testing.
To activate the Nova virtualenv for the extent of your current shell
session you can run:
.....

但是当我尝试运行特定的单元测试,比如:

./run_tests.sh test_libvirt

结果却失败了,提示:

Running `tools/with_venv.sh python -m nova.openstack.common.lockutils python setup.py testr --testr-args='--subunit --concurrency 0  test_libvirt'`

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/chinmay/nova/nova/openstack/common/lockutils.py", line 29, in <module>
    from oslo.config import cfg
**ImportError: No module named config**
Ran 0 tests in 0.006s
OK

这个虚拟环境是不是没有设置好?oslo.config在环境里。我执行了 source .venv/bin/activate 然后再试一次,但结果还是一样。

我是不是漏掉了什么?

1 个回答

1

请在你的虚拟环境中先把 oslo.config 删除掉,然后再重新安装一次。这可能会解决你的问题哦 :)

撰写回答