ImportError: No module named lib.python2.7.distutils

Asked by ericwong

Hi,

I followed instruction on the http://testutils.org/sst/
But when I run the command sst-run test, it always throw the exception as below. I could not found a answer myself or even googled it. Could you please help me out?

(python27)ewang@ewang-virtual-machine:~/python27$ sst-run -V
SST version: 0.2.4
(python27)ewang@ewang-virtual-machine:~/python27$ sst-run test
Traceback (most recent call last):
  File "/home/ewang/python27/bin/sst-run", line 9, in <module>
    load_entry_point('sst==0.2.4', 'console_scripts', 'sst-run')()
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/scripts/run.py", line 64, in main
    excludes=cmd_opts.excludes
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/runtests.py", line 83, in runtests
    alltests.addTests(loader.discoverTestsFromTree(test_dir))
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 129, in discoverTestsFromTree
    suite.addTests(self.discoverTestsFromNames(dir_path, names))
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 140, in discoverTestsFromNames
    suite.addTests(self.discoverTestsFromTree(path))
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 129, in discoverTestsFromTree
    suite.addTests(self.discoverTestsFromNames(dir_path, names))
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 140, in discoverTestsFromNames
    suite.addTests(self.discoverTestsFromTree(path))
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 129, in discoverTestsFromTree
    suite.addTests(self.discoverTestsFromNames(dir_path, names))
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 140, in discoverTestsFromNames
    suite.addTests(self.discoverTestsFromTree(path))
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 113, in discoverTestsFromTree
    package = self.importFromPath(dir_path)
  File "/home/ewang/python27/local/lib/python2.7/site-packages/sst/loaders.py", line 163, in importFromPath
    __import__(mod_name)
ImportError: No module named lib.python2.7.distutils

Question information

Language:
English Edit question
Status:
Solved
For:
selenium-simple-test Edit question
Assignee:
No assignee Edit question
Solved by:
ericwong
Solved:
Last query:
Last reply:
Revision history for this message
Javier Collado (javier.collado) said :
#1

I think the problem here is that the ENV directory is under the directory
where sst-run is launched which causes the test discovery functionality look
into ENV/lib/python2.7/distutils for test cases.

To fix the problem, move your test script to a different directory that just
contains the test case that you want to run. Something like
"sst-example/mytests.py" should work fine.

Revision history for this message
ericwong (55158644-y) said :
#2

Thanks Javier, after move the test script out of the VIRTUALENV folder. It works well.