diff options
| author | Gael Pasgrimaud <gael@gawel.org> | 2014-04-15 21:14:27 +0200 |
|---|---|---|
| committer | Gael Pasgrimaud <gael@gawel.org> | 2014-04-15 21:14:27 +0200 |
| commit | 780f6d54944c31194e7a39ba0e5f2c69c4f24867 (patch) | |
| tree | 0f8c5d32d982f6a6c9f30d3243cbd7b19e041a13 /webtest | |
| parent | 54e7fe1c9be27cece0fb94118d3f4c46e51577b1 (diff) | |
| download | webtest-780f6d54944c31194e7a39ba0e5f2c69c4f24867.tar.gz | |
Fixed #107 Explicit error message when WSGIProxy2 is not installer
Diffstat (limited to 'webtest')
| -rw-r--r-- | webtest/app.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/webtest/app.py b/webtest/app.py index e58ba46..6acdde1 100644 --- a/webtest/app.py +++ b/webtest/app.py @@ -120,7 +120,13 @@ class TestApp(object): app = os.environ['WEBTEST_TARGET_URL'] if isinstance(app, string_types): if app.startswith('http'): - from wsgiproxy import HostProxy + try: + from wsgiproxy import HostProxy + except ImportError: + raise ImportError(( + 'Using webtest with a real url requires WSGIProxy2. ' + 'Please install it with: ' + 'pip install WSGIProxy2')) if '#' not in app: app += '#httplib' url, client = app.split('#', 1) @@ -571,7 +577,8 @@ class TestApp(object): def _gen_request(self, method, url, params=utils.NoDefault, headers=None, extra_environ=None, status=None, - upload_files=None, expect_errors=False, content_type=None): + upload_files=None, expect_errors=False, + content_type=None): """ Do a generic request. """ |
