[MERGE][0.90][0.91][Bug 137044] ftp password handling broken

Martin Pool mbp at sourcefrog.net
Mon Sep 10 08:52:41 BST 2007


> I've noticed that even when I'm only running a few tests, "bzr selftest"
> takes a long time to start running tests.  I'm interested in fixing
> that, and it seems likely that lazy_import would help.

Yes, it takes quite a while just to construct all the test objects:
`bzr selftest --list-only` takes 6.5s on my core2 duo desktop.  This
contributes to some of the slowest tests in the suite, the ones that
test the test loader and test filtering.

I'm not sure how much of that is import time compared to object
construction or other things.

One way to help this would be to add an option that filters by test
module, not test name.  Then we could avoid loading those modules and
initializing their tests.

Also it seems that --profile-imports interacts badly with the test loader:

  mbp at grace% time ./bzr --profile-imports selftest --list-only
/home/mbp/bzr/trunk/profile_imports.py:20: DeprecationWarning: The sre
module is deprecated, please import re.
  import sre

bzr: ERROR: exceptions.TypeError: timed_import() takes exactly 4
arguments (1 given)

Traceback (most recent call last):
  File "/home/mbp/bzr/trunk/bzrlib/commands.py", line 800, in
run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/mbp/bzr/trunk/bzrlib/commands.py", line 758, in run_bzr
    ret = run(*run_argv)
  File "/home/mbp/bzr/trunk/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/mbp/bzr/trunk/bzrlib/builtins.py", line 2602, in run
    strict=strict,
  File "/home/mbp/bzr/trunk/bzrlib/tests/__init__.py", line 2333, in selftest
    suite = test_suite()
  File "/home/mbp/bzr/trunk/bzrlib/tests/__init__.py", line 2486, in test_suite
    suite.addTest(loader.loadTestsFromModuleNames(testmod_names))
  File "/home/mbp/bzr/trunk/bzrlib/tests/TestUtil.py", line 89, in
loadTestsFromModuleNames
    _load_module_by_name(name)
  File "/home/mbp/bzr/trunk/bzrlib/tests/TestUtil.py", line 96, in
_load_module_by_name
    module = __import__(mod_name)
TypeError: timed_import() takes exactly 4 arguments (1 given)

bzr 0.91.0dev0 on python 2.5.1.final.0 (linux2)
arguments: ['./bzr', 'selftest', '--list-only']


-- 
Martin



More information about the bazaar mailing list