Unittest import error

Zahari Zahariev zahari.zahariev at gmail.com
Thu May 13 05:00:05 MDT 2010


Hi Jelmer,

If the test is new and it is not in the Shell scripts that run make test.
Say you want to create a brand new file off ldap.py the new one won't be
listed in 'make TEST' system if you do not go and do it manually.

Cheers!

On Thu, May 13, 2010 at 10:22 AM, Jelmer Vernooij <jelmer at samba.org> wrote:

> 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