bzr-git tests abort test run if dulwich mismatch

Bug #529648 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar Git Plugin
Triaged
Low
Unassigned

Bug Description

 affects bzr-git
 done

When I run
'bzr selftest plugin_info'

bzr-git throws an exception and stops the test run.

This is naughty: it should do one of:
 - fail to import (raise ImportError). This will be logged but the test
run will continue
 - load the tests and let them fail
 - load the tests and have all the dulwich dependending ones require a
dulwich_feature - this can be done declaratively, and will result in
them all skipping

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 529648] [NEW] bzr-git tests abort test run if dulwich mismatch

On Sun, 2010-02-28 at 20:13 +0000, Robert Collins wrote:
> Public bug reported:
>
> affects bzr-git
> done
>
> When I run
> 'bzr selftest plugin_info'
>
> bzr-git throws an exception and stops the test run.
>
> This is naughty: it should do one of:
> - fail to import (raise ImportError). This will be logged but the test
> run will continue
It does this but raises DependencyNotPresent rather than ImportError,
which is part of bzrlib.errors. Could bzr perhaps catch this error as
well?

Cheers,

Jelmer

Revision history for this message
Robert Collins (lifeless) wrote :

On Sun, 2010-02-28 at 20:33 +0000, Jelmer Vernooij wrote:

> > This is naughty: it should do one of:
> > - fail to import (raise ImportError). This will be logged but the test
> > run will continue
> It does this but raises DependencyNotPresent rather than ImportError,
> which is part of bzrlib.errors. Could bzr perhaps catch this error as
> well?

I don't think the test infrastructure should do that: it won't be known
by other runners at all.

-Rob

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 529648] [NEW] bzr-git tests abort test run if dulwich mismatch

----- Original message -----
> On Sun, 2010-02-28 at 20:33 +0000, Jelmer Vernooij wrote:
>
> > > This is naughty: it should do one of:
> > >  - fail to import (raise ImportError). This will be logged but the test
> > > run will continue
> > It does this but raises DependencyNotPresent rather than ImportError,
> > which is part of bzrlib.errors. Could bzr perhaps catch this error as
> > well?
>
> I don't think the test infrastructure should do that: it won't be known
> by other runners at all.
Can we then perhaps have DependencyNotPresent derive from ImportError ? Otherwise it's not really usable in plugins.

Cheers, jelmer

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 529648] [NEW] bzr-git tests abort test run if dulwich mismatch

On Sun, 2010-02-28 at 22:15 +0000, Jelmer Vernooij wrote:
> ----- Original message -----
> > On Sun, 2010-02-28 at 20:33 +0000, Jelmer Vernooij wrote:
> >
> > > > This is naughty: it should do one of:
> > > > - fail to import (raise ImportError). This will be logged but the test
> > > > run will continue
> > > It does this but raises DependencyNotPresent rather than ImportError,
> > > which is part of bzrlib.errors. Could bzr perhaps catch this error as
> > > well?
> >
> > I don't think the test infrastructure should do that: it won't be known
> > by other runners at all.
> Can we then perhaps have DependencyNotPresent derive from ImportError ? Otherwise it's not really usable in plugins.

I don't understand why you need this in the test suite though.

Is it because you have

import dulwich

in a plugin source file? If so, if you wrap it in lazy_import, that
should work.

-Rob

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Sun, 2010-02-28 at 22:47 +0000, Robert Collins wrote:
> On Sun, 2010-02-28 at 22:15 +0000, Jelmer Vernooij wrote:
> > ----- Original message -----
> > > On Sun, 2010-02-28 at 20:33 +0000, Jelmer Vernooij wrote:
> > >
> > > > > This is naughty: it should do one of:
> > > > > - fail to import (raise ImportError). This will be logged but the test
> > > > > run will continue
> > > > It does this but raises DependencyNotPresent rather than ImportError,
> > > > which is part of bzrlib.errors. Could bzr perhaps catch this error as
> > > > well?
> > >
> > > I don't think the test infrastructure should do that: it won't be known
> > > by other runners at all.
> > Can we then perhaps have DependencyNotPresent derive from ImportError ? Otherwise it's not really usable in plugins.
>
> I don't understand why you need this in the test suite though.
>
> Is it because you have
>
> import dulwich
>
> in a plugin source file? If so, if you wrap it in lazy_import, that
> should work.
It seems a lot easier (and correct anyway) to just make
DependencyNotPresent derive from ImportError.

Also, lazy_import makes pyflakes useless.

Cheers,

Jelmer

Revision history for this message
Robert Collins (lifeless) wrote :

On Mon, 2010-03-01 at 01:43 +0000, Jelmer Vernooij wrote:

> It seems a lot easier (and correct anyway) to just make
> DependencyNotPresent derive from ImportError.

DependencyNotPresent can occur outside of imports, so I don't think we
should change what it derives from (and multiple inheritance in
exceptions is unlikely to end well).

> Also, lazy_import makes pyflakes useless.

There is a patch for that.

-Rob

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

  status triaged
  importance low

Changed in bzr-git:
importance: Undecided → Low
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.