Saturday, June 11, 2011

" test" throwing "ValueError: Empty module name"

Running ' test' suddenly started throwing a ValueError:

$ /usr/bin/python ./ test
running test
running egg_info
writing pyVBox.egg-info/PKG-INFO
writing top-level names to pyVBox.egg-info/top_level.txt
writing dependency_links to pyVBox.egg-info/dependency_links.txt
reading manifest file 'pyVBox.egg-info/SOURCES.txt'
writing manifest file 'pyVBox.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "./", line 17, in
    url = ""
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/", line 576, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
ValueError: Empty module name
Poking around with pdb, it turns out it was because the name argument to loadTestsFromName():

(Pdb) print parts_copy
['test', '', '#VirtualMachineTests']
(Pdb) print name

Which turns out to be caused by a Emacs autosave file. I had unsaved changes in my Emacs buffer. Once I saved them, the autosave file went away and ' test' ran fine.

Obviously some deeper problem here with tripping over these files.