~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_urllib.py

  • Committer: v.ladeuil+lp at free
  • Date: 2006-10-12 14:29:32 UTC
  • mto: (2145.1.1 keepalive)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: v.ladeuil+lp@free.fr-20061012142932-7221fe16d2b48fa3
Shuffle http related test code. Hopefully it ends up at the right place :)

* bzrlib/tests/HttpServer.py: 
New file. bzrlib.tests.ChrootedTestCase use HttpServer. So the
class can't be defined in bzrlib.tests.HTTPUtils because it
creates a circular dependency (bzrlib.tests.HTTPUtils needs to
import bzrlib.tests).

* bzrlib/transport/http/_urllib.py: 
Transfer test server definition to bzrlib.tests.HttpServer. Clean
up imports.

* bzrlib/transport/http/_pycurl.py: 
Transfer test server definition to bzrlib.tests.HttpServer. Clean
up imports.

* bzrlib/transport/http/__init__.py: 
Transfer all test related code to either bzrlib.tests.HttpServer
and bzrlib.tests.HTTPUtils.
Fix all use of TransportNotPossible and InvalidURL by prefixing it
by 'errors.' (this seems to be the preferred way in the rest of
bzr).
Get rid of unused imports.

* bzrlib/tests/test_transport.py:
(ReadonlyDecoratorTransportTest.test_local_parameters,
FakeNFSDecoratorTests.test_http_parameters): Use HttpServer from
bzrlib.tests.HttpServer instead of bzrlib.transport.http.

* bzrlib/tests/test_sftp_transport.py:
(set_test_transport_to_sftp): Use HttpServer from
bzrlib.tests.HttpServer instead of bzrlib.transport.http.

* bzrlib/tests/test_selftest.py:
(TestTestCaseWithTransport.test_get_readonly_url_http): Use
HttpServer from bzrlib.tests.HttpServer instead of
bzrlib.transport.http.

* bzrlib/tests/test_repository.py: 
Does *not* use HttpServer.

* bzrlib/tests/test_http.py: 
Build on top of bzrlib.tests.HttpServer and bzrlib.tests.HTTPUtils
instead of bzrlib.transport.http.

* bzrlib/tests/test_bzrdir.py:
(ChrootedTests.setUp): Use HttpServer from bzrlib.tests.HttpServer
instead of bzrlib.transport.http.

* bzrlib/tests/branch_implementations/test_http.py:
(HTTPBranchTests.setUp): Use HttpServer from bzrlib.tests.HttpServer
instead of bzrlib.transport.http.

* bzrlib/tests/branch_implementations/test_branch.py:
(ChrootedTests.setUp): Use HttpServer from bzrlib.tests.HttpServer
instead of bzrlib.transport.http.

* bzrlib/tests/__init__.py:
(ChrootedTestCase.setUp): Use HttpServer from
bzrlib.tests.HttpServer instead of bzrlib.transport.http.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import errno
18
 
import urllib, urllib2
19
 
import errno
20
17
from cStringIO import StringIO
21
18
 
22
19
from bzrlib import ui
23
 
from bzrlib.errors import (TransportNotPossible,
24
 
                           NoSuchFile,
25
 
                           BzrError,
26
 
                           TransportError,
27
 
                           ConnectionError,
28
 
                           )
 
20
from bzrlib.errors import NoSuchFile
29
21
from bzrlib.trace import mutter
30
22
from bzrlib.transport import register_urlparse_netloc_protocol
31
 
from bzrlib.transport.http import (HttpTransportBase,
32
 
                                   HttpServer)
 
23
from bzrlib.transport.http import HttpTransportBase
33
24
# TODO: handle_response should be integrated into the _urllib2_wrappers
34
25
from bzrlib.transport.http.response import handle_response
35
26
from bzrlib.transport.http._urllib2_wrappers import (
178
169
            return False
179
170
 
180
171
 
181
 
class HttpServer_urllib(HttpServer):
182
 
    """Subclass of HttpServer that gives http+urllib urls.
183
 
 
184
 
    This is for use in testing: connections to this server will always go
185
 
    through urllib where possible.
186
 
    """
187
 
 
188
 
    # urls returned by this server should require the urllib client impl
189
 
    _url_protocol = 'http+urllib'
190
 
 
191
 
 
192
172
def get_test_permutations():
193
173
    """Return the permutations to be used in testing."""
 
174
    from bzrlib.tests.HttpServer import HttpServer_urllib
194
175
    return [(HttpTransport_urllib, HttpServer_urllib),
195
176
            ]