run_test.py w/ new directory

Asked by fred yang

Hi,

I have created a new subdiretory ~/nova/nova/attestation with a new file service.py. I have also create a new unit test under ~/nova/tests/scheduler/test_attestation.py where has "from nova.attestation import service"

When I run "python run_tests.py scheduler.test_attestation:TestAttestation.test_sdk", I am experiencing following error.
that can't locate attestation directory. Do I need to specify new created directory in anyplace for testing?

Thanks,

fred@storky:~/d2/nova$ python run_tests.py scheduler.test_attestation:TestAttestation.test_sdk
2011-08-18 10:37:51,066 INFO rdflib [-] version: 2.4.2
Failure
    runTest ERROR

======================================================================
ERROR: Failure: ImportError (No module named attestation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/loader.py", line 382, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/pymodules/python2.7/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/pymodules/python2.7/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/fred/d2/nova/nova/tests/scheduler/test_attestation.py", line 40, in <module>
    from nova.attestation import service
ImportError: No module named attestation

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
Brian Lamar
Solved:
Last query:
Last reply:
Revision history for this message
Best Brian Lamar (blamar) said :
#1

Make sure your 'attestation' directory contains an __init__.py file. Python requires these files to certify that the directory is a module.

Revision history for this message
fred yang (fred-yang) said :
#2

Thanks Brian Lamar, that solved my question.