运行Python 3 unittest时抛出AttributeError

时间:2016-02-11 21:15:37

标签: python linux unit-testing python-3.x

我正在尝试运行以下python命令来启动unittest,但它在我的Linux环境中失败了。但是,同样的命令在我的Windows环境中运行良好。无法弄清楚可能出现的问题。有什么建议? 请注意"持久性"是一个python包," PersistenceAcceptanceTest.py"是" persistence"。

下的python文件
    $ /opt/python-3.4.3/bin/python3.4 -m unittest persistence.PersistenceAcceptanceTest -v
Traceback (most recent call last):
  File "/opt/python-3.4.3/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/python-3.4.3/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/python-3.4.3/lib/python3.4/unittest/__main__.py", line 18, in <module>
    main(module=None)
  File "/opt/python-3.4.3/lib/python3.4/unittest/main.py", line 92, in __init__
    self.parseArgs(argv)
  File "/opt/python-3.4.3/lib/python3.4/unittest/main.py", line 139, in parseArgs
    self.createTests()
  File "/opt/python-3.4.3/lib/python3.4/unittest/main.py", line 146, in createTests
    self.module)
  File "/opt/python-3.4.3/lib/python3.4/unittest/loader.py", line 146, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/opt/python-3.4.3/lib/python3.4/unittest/loader.py", line 146, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/opt/python-3.4.3/lib/python3.4/unittest/loader.py", line 114, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'PersistenceAcceptanceTest'

0 个答案:

没有答案