[Merge] Slow socket

John Arbash Meinel john at arbash-meinel.com
Fri Aug 18 15:55:38 BST 2006


Carl Friedrich Bolz wrote:
> Carl Friedrich Bolz wrote:
>> I've updated the slow-socket patch once again, I hope it is ok now.
> 
> oops, forgot to attach it...
> 

> === added file 'bzrlib/benchmarks/bench_sftp.py'
> --- bzrlib/benchmarks/bench_sftp.py	1970-01-01 00:00:00 +0000
> +++ bzrlib/benchmarks/bench_sftp.py	2006-08-17 12:37:38 +0000
> @@ -0,0 +1,76 @@
> +import os

-- PEP8 need a space here
v- And these should be sorted in alphabetical order.

> +from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
> +from bzrlib.benchmarks import Benchmark
> +from bzrlib import bzrdir
> +import bzrlib.transport
> +import bzrlib.transport.http
> +from bzrlib.workingtree import WorkingTree
> +from bzrlib.tests import test_sftp_transport
> +
> +try:
> +    import paramiko
> +    paramiko_loaded = True
> +except ImportError:
> +    paramiko_loaded = False
> +
> +
> +class SFTPBenchmark(Benchmark):
> +    """Benchmark branch, push and pull across a local sftp connection."""
> +
> +    def setUp(self):
> +        super(SFTPBenchmark, self).setUp()
> +        if not paramiko_loaded:
> +            raise TestSkipped('you must have paramiko to run this test')
> +        test_sftp_transport.set_transport(self) 

^-- This line took me a while to figure out. When I read it, I thought
you were setting the transport of 'test_sftp_transport' to 'self'. Not
setting the transport of self to an appropriate transport.
I think we should rename the function to something like:
set_test_transport_to_sftp()

...

>  
> +def set_transport(testcase):
> +    """A helper to set transports on test case instances."""
> +    from bzrlib.transport.sftp import SFTPAbsoluteServer, SFTPHomeDirServer
> +    if getattr(testcase, '_get_remote_is_absolute', None) is None:
> +        testcase._get_remote_is_absolute = True
> +    if testcase._get_remote_is_absolute:
> +        testcase.transport_server = SFTPAbsoluteServer
> +    else:
> +        testcase.transport_server = SFTPHomeDirServer
> +    testcase.transport_readonly_server = bzrlib.transport.http.HttpServer
> +

Other than the function name and minor PEP8 stuff I think this is ready.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060818/aecf6498/attachment.pgp 


More information about the bazaar mailing list