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 | |
parent | 54e7fe1c9be27cece0fb94118d3f4c46e51577b1 (diff) | |
download | webtest-780f6d54944c31194e7a39ba0e5f2c69c4f24867.tar.gz |
Fixed #107 Explicit error message when WSGIProxy2 is not installer
-rw-r--r-- | CHANGELOG.rst | 2 | ||||
-rw-r--r-- | webtest/app.py | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 34905ba..e8d8f04 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ News 2.0.15 (unreleased) ------------------- -- Nothing changed yet. +- Fixed #107 Explicit error message when WSGIProxy2 is not installer 2.0.14 (2014-01-23) 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. """ |