Unittest import error
Jelmer Vernooij
jelmer at samba.org
Thu May 13 01:22:16 MDT 2010
Hi Zahari,
On Thu, 2010-05-13 at 10:11 +0300, Zahari Zahariev wrote:
> Anatoliy has had the same problem and told me a bit later that
> "python-subunit" was an additional package.
> Why isn't it in ./configure script as this is obviously a constant
> problem for people trying to run individual unittests? I think this
> problem should be addressed because the last time when I was
> using/writing unittests for Ldb (6 months ago) there was no such
> issue.
This is only an issue for the unit tests in lib/ldb, the other tests all
use a convenience function in the samba python module that can
automatically do the import for you.
Is there any reason for not just using "make test TESTS=ldap..." ?
Cheers,
Jelmer
> On Wed, May 12, 2010 at 6:21 PM, Jelmer Vernooij <jelmer at vernstok.nl>
> wrote:
> Hi Zahari,
>
>
> On Wed, 2010-05-12 at 16:15 +0300, Zahari Zahariev wrote:
> >
> > I wanted to start some manual unittest files and I bumped
> into an
> > error:
> >
> >
> > root at darkstar:~/samba-master/source4# python
> > lib/ldb/tests/python/ldap.py localhost -U%
> > Traceback (most recent call last):
> > File "lib/ldb/tests/python/ldap.py", line 31, in <module>
> > from subunit.run import SubunitTestRunner
> > ImportError: No module named subunit.run
> >
> >
> > Can you tell why does this happen?
>
> You should either have subunit installed on your system or you
> need to
> pull in the version that is included with Samba somehow. The
> latter is
> probably not desirable since that file lives in the ldb
> directory and we
> do want ldb to be installable standalone.
>
> So you could either add an attempt to import 'samba' and a
> call to
> ensure_external() in that file (but allowing that to fail, as
> the samba
> module might not be available), or you could install subunit
> on your
> system or you could set PYTHONPATH to a path that includes the
> subunit
> that is included with Samba (../lib/subunit/python IIRC).
>
> Cheers,
>
> Jelmer
>
>
>
More information about the samba-technical
mailing list