[BUG] NameError: global name 'ssh' is not defined

Andrew Bennetts andrew at canonical.com
Thu Sep 14 04:19:05 BST 2006


John Arbash Meinel wrote:
> Andrew Bennetts wrote:
[...]
> > 
> > I've attached a bundle that should fix this, and a couple of other pyflakes
> > nits in those files.  Clearly the tests are lacking though; we should probably
> > make it so the ParamikoVendor is always tested, regardless of whether OpenSSH is
> > available.  Or rather, test *every* available SSH implementation (and paramiko
> > is a hard dependency, so it's always available).
> > 
> > -Andrew.
> > 
> 
> Well, we had a 'make sure we can do a real connection' test. But that
> might just use whatever implementation is available.
> 
> Specifically, in bzrlib/tests/test_sftp_tranpsort.py we have:
> class SSHVendorConnection(TestCaseWithSFTPServer):
>     """Test that the ssh vendors can all connect.
> 
>     Verify that a full-handshake (SSH over loopback TCP) sftp connection
> works.
> 
>     We have 3 sftp implementations in the test suite:
[...]

> So we do test that we can actually connect with each. But unfortunately
> it is done by manually setting 'self._test_vendor = ssh.ParamikoVendor'.
> 
> So we know that we can connect with at least Paramiko and loopback (I
> don't think we are testing None.)

Ah, ok.  So it's not as bad as I thought.

> What we need is a test of _get_ssh_vendor(). We could restrict the path
> to just the local working directory, which will force 'ssh -V' to fail,
> and that can check that we fall back to paramiko.

Yes, it would be good to test _get_ssh_vendor() better.  I worry that mucking
about with $PATH is still a bit indirect and fragile, but it's probably good
enough.

-Andrew.





More information about the bazaar mailing list