[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Python: Including Nosetest



Dear lists,

I am working on a package (python-pywcs) that may include a "nosetest"
which I want to run before installation.

For this, I put the following line into debian/rules (for debhelper):

override_dh_auto_test:
	nosetest

However, when I try to build the package, I get the error

======================================================================
ERROR: Failure: ImportError (No module named _pywcs)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/loader.py", line 390, 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/oles/Projects/2010/launchpad-cpl/build/sid/pywcs-1.10-4.7/tests/test.py",
line 8, in <module>
    import pywcs
  File
"/home/oles/Projects/2010/launchpad-cpl/build/sid/pywcs-1.10-4.7/lib/pywcs.py",
line 71, in <module>
    import _pywcs
ImportError: No module named _pywcs

----------------------------------------------------------------------

This error comes from the fact, that the nosetest uses the current
directory as the first entry in the path and so tries to read the source
directory (pywcs/...) and not the build-and-not-installed-yet version in
build/lib.linux-x86_64-2.6/ (and ...2.7). Since I assume that it is not
very clean just to include that path (or chdir there before running the
test), I guess there is another solution on how to run nosetest during
package build?

Best regards

Ole


Reply to: