The way I would suggest handling this is by moving the server into a separate module that depends on testtools but that does not need to be loaded in normal use.
File ".../bzr.dev/bzrlib/transport/__init__.py", line 1589, in get_transport
transport, last_err = _try_transport_factories(base, factory_list)
File ".../bzr.dev/bzrlib/transport/__init__.py", line 1612, in _try_transport_factories
return factory.get_obj()(base), None
File ".../bzr.dev/bzrlib/registry.py", line 61, in get_obj
self._do_import()
File ".../bzr.dev/bzrlib/registry.py", line 70, in _do_import
obj = __import__(self._module_name, globals(), locals(), names)
File ".../bzr.dev/bzrlib/transport/sftp.py", line 890, in <module>
from bzrlib.tests.stub_sftp import StubServer, StubSFTPServer
File ".../bzr.dev/bzrlib/tests/__init__.py", line 53, in <module>
import testtools
ImportError: No module named testtools
The way I would suggest handling this is by moving the server into a separate module that depends on testtools but that does not need to be loaded in normal use.
File ".../bzr. dev/bzrlib/ transport/ __init_ _.py", line 1589, in get_transport factories( base, factory_list) dev/bzrlib/ transport/ __init_ _.py", line 1612, in _try_transport_ factories get_obj( )(base) , None dev/bzrlib/ registry. py", line 61, in get_obj _do_import( ) dev/bzrlib/ registry. py", line 70, in _do_import _(self. _module_ name, globals(), locals(), names) dev/bzrlib/ transport/ sftp.py" , line 890, in <module> tests.stub_ sftp import StubServer, StubSFTPServer dev/bzrlib/ tests/_ _init__ .py", line 53, in <module>
transport, last_err = _try_transport_
File ".../bzr.
return factory.
File ".../bzr.
self.
File ".../bzr.
obj = __import_
File ".../bzr.
from bzrlib.
File ".../bzr.
import testtools
ImportError: No module named testtools