Hello community, here is the log from the commit of package python-WebTest for openSUSE:Factory checked in at 2012-06-10 20:19:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-WebTest (Old) and /work/SRC/openSUSE:Factory/.python-WebTest.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-WebTest", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-WebTest/python-WebTest.changes 2012-02-01 10:00:18.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-WebTest.new/python-WebTest.changes 2012-06-10 21:52:21.000000000 +0200 @@ -1,0 +2,16 @@ +Wed Jun 6 21:17:27 UTC 2012 - os-dev@jacraig.com + +- Update to 1.3.4: + * fix `#33 https://bitbucket.org/ianb/webtest/issue/33`_ Remove + CaptureStdout. Do nothing and break pdb + * use OrderedDict to store fields in form. See + `#31 https://bitbucket.org/ianb/webtest/issue/31`_ + * fix `#38 https://bitbucket.org/ianb/webtest/issue/38`_ Allow to post + falsey values. + * fix `#37 https://bitbucket.org/ianb/webtest/issue/37`_ Allow + Content-Length: 0 without Content-Type + * `fix #30 https://bitbucket.org/ianb/webtest/issue/30`_ bad link to + pyquery documentation + * Never catch NameError during iteration + +------------------------------------------------------------------- Old: ---- WebTest-1.3.3.tar.gz New: ---- WebTest-1.3.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-WebTest.spec ++++++ --- /var/tmp/diff_new_pack.v7SdVm/_old 2012-06-10 21:52:22.000000000 +0200 +++ /var/tmp/diff_new_pack.v7SdVm/_new 2012-06-10 21:52:22.000000000 +0200 @@ -14,8 +14,10 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + + Name: python-WebTest -Version: 1.3.3 +Version: 1.3.4 Release: 0 Url: http://webtest.pythonpaste.org/ Summary: Helper to test WSGI applications ++++++ WebTest-1.3.3.tar.gz -> WebTest-1.3.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/PKG-INFO new/WebTest-1.3.4/PKG-INFO --- old/WebTest-1.3.3/PKG-INFO 2011-11-21 15:02:55.000000000 +0100 +++ new/WebTest-1.3.4/PKG-INFO 2012-05-04 18:10:30.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: WebTest -Version: 1.3.3 +Version: 1.3.4 Summary: Helper to test WSGI applications Home-page: http://webtest.pythonpaste.org/ Author: Gael Pasgrimaud diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/WebTest.egg-info/PKG-INFO new/WebTest-1.3.4/WebTest.egg-info/PKG-INFO --- old/WebTest-1.3.3/WebTest.egg-info/PKG-INFO 2011-11-21 15:02:50.000000000 +0100 +++ new/WebTest-1.3.4/WebTest.egg-info/PKG-INFO 2012-05-04 18:10:28.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: WebTest -Version: 1.3.3 +Version: 1.3.4 Summary: Helper to test WSGI applications Home-page: http://webtest.pythonpaste.org/ Author: Gael Pasgrimaud diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/docs/index.txt new/WebTest-1.3.4/docs/index.txt --- old/WebTest-1.3.3/docs/index.txt 2011-10-30 00:51:23.000000000 +0200 +++ new/WebTest-1.3.4/docs/index.txt 2012-01-25 09:49:29.000000000 +0100 @@ -257,7 +257,7 @@ >>> print(form.method) POST >>> # dict of fields - >>> fields.values() #doctest: +SKIP + >>> form.fields.values() #doctest: +SKIP [(u'name', [<Text name="name">]), (u'submit', [<Submit name="submit">])] >>> form['name'] = 'Bob' >>> # When names don't point to a single field: @@ -304,7 +304,7 @@ response body. ``response.pyquery``: - Return an `PyQuery http://pyquery.org/`_ version of the + Return an `PyQuery http://pypi.python.org/pypi/pyquery`_ version of the response body. ``response.json``: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/docs/news.txt new/WebTest-1.3.4/docs/news.txt --- old/WebTest-1.3.3/docs/news.txt 2011-10-30 00:38:58.000000000 +0200 +++ new/WebTest-1.3.4/docs/news.txt 2012-05-04 18:09:14.000000000 +0200 @@ -1,6 +1,27 @@ News ==== +1.3.4 +----- + + +* fix `#33 https://bitbucket.org/ianb/webtest/issue/33`_ Remove + CaptureStdout. Do nothing and break pdb + +* use OrderedDict to store fields in form. See + `#31 https://bitbucket.org/ianb/webtest/issue/31`_ + +* fix `#38 https://bitbucket.org/ianb/webtest/issue/38`_ Allow to post falsey + values. + +* fix `#37 https://bitbucket.org/ianb/webtest/issue/37`_ Allow + Content-Length: 0 without Content-Type + +* `fix #30 https://bitbucket.org/ianb/webtest/issue/30`_ bad link to pyquery + documentation + +* Never catch NameError during iteration + 1.3.3 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/setup.cfg new/WebTest-1.3.4/setup.cfg --- old/WebTest-1.3.3/setup.cfg 2011-11-21 15:02:55.000000000 +0100 +++ new/WebTest-1.3.4/setup.cfg 2012-05-04 18:10:30.000000000 +0200 @@ -1,18 +1,18 @@ -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 +[aliases] +distribute = register sdist --formats=zip,gztar upload [nosetests] -cover-package = webtest -doctest-fixtures = _fixt verbosity = 2 -doctest-extension = txt -with-coverage = true detailed-errors = True with-doctest = True +doctest-extension = txt +doctest-fixtures = _fixt include = docs +with-coverage = true +cover-package = webtest -[aliases] -distribute = register sdist --formats=zip,gztar upload +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/setup.py new/WebTest-1.3.4/setup.py --- old/WebTest-1.3.3/setup.py 2011-11-21 15:01:33.000000000 +0100 +++ new/WebTest-1.3.4/setup.py 2012-05-04 18:08:32.000000000 +0200 @@ -1,10 +1,8 @@ #!/usr/bin/env python from setuptools import setup from setuptools import find_packages -import sys -import os -version = '1.3.3' +version = '1.3.4' setup(name='WebTest', version=version, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/tests/compat.py new/WebTest-1.3.4/tests/compat.py --- old/WebTest-1.3.3/tests/compat.py 2011-08-27 18:15:35.000000000 +0200 +++ new/WebTest-1.3.4/tests/compat.py 2012-02-18 16:12:04.000000000 +0100 @@ -16,6 +16,8 @@ def b(value): return str(value) def u(value): + if isinstance(value, unicode): + return value return unicode(value, 'utf-8') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/tests/test_testing.py new/WebTest-1.3.4/tests/test_testing.py --- old/WebTest-1.3.3/tests/test_testing.py 2011-10-30 00:29:14.000000000 +0200 +++ new/WebTest-1.3.4/tests/test_testing.py 2012-05-04 17:55:26.000000000 +0200 @@ -8,7 +8,6 @@ import webbrowser - def test_print_unicode(): print_stderr(u('°C')) @@ -45,19 +44,23 @@ content_type='application/x-www-form-urlencoded;charset=utf8') res.mustcontain('a=%C3%A9') - def test_get_params(self): + def test_post_params(self): res = self.app.post('/', params=dict(a=1)) res.mustcontain('a=1') - res = self.app.post('/', params=[('a','1')]) + res = self.app.post('/', params=[('a', '1')]) res.mustcontain('a=1') res = self.app.post_json('/', params=dict(a=1)) res.mustcontain('{"a": 1}') + res = self.app.post_json('/', params=False) + res.mustcontain('false') def test_put_params(self): res = self.app.put('/', params=dict(a=1)) res.mustcontain('a=1') res = self.app.put_json('/', params=dict(a=1)) res.mustcontain('{"a": 1}') + res = self.app.put_json('/', params=False) + res.mustcontain('false') def test_delete_params(self): res = self.app.delete('/', params=dict(a=1)) @@ -71,7 +74,8 @@ def test_exception(self): self.assertRaises(Exception, self.app.get, '/?error=t') - self.assertRaises(webtest.AppError, self.app.get, '/?status=404%20Not%20Found') + self.assertRaises(webtest.AppError, self.app.get, + '/?status=404%20Not%20Found') def test_request_obj(self): res = self.app.get('/') @@ -80,8 +84,10 @@ def test_showbrowser(self): open_new = webbrowser.open_new self.filename = '' + def open_new(f): self.filename = f + webbrowser.open_new = open_new res = self.app.get('/') res.showbrowser() @@ -97,10 +103,10 @@ self.assertEqual(res.request.url, 'http://localhost/foo') self.assertIn('Response: 200 OK', str(res)) self.assertIn('200 OK', repr(res)) - res = self.app.get('/?status=303%20redirect', status='3*') + self.app.get('/?status=303%20redirect', status='3*') def test_204(self): - res = self.app.post('/?status=204%20OK') + self.app.post('/?status=204%20OK') def test_404(self): self.app.get('/?status=404%20Not%20Found', status=404) @@ -110,5 +116,4 @@ class FakeDict(object): def items(self): return [('a', '10'), ('a', '20')] - res = self.app.post('/params', params=FakeDict()) - + self.app.post('/params', params=FakeDict()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/webtest/app.py new/WebTest-1.3.4/webtest/app.py --- old/WebTest-1.3.3/webtest/app.py 2011-10-30 00:28:48.000000000 +0200 +++ new/WebTest-1.3.4/webtest/app.py 2012-05-04 17:53:14.000000000 +0200 @@ -8,12 +8,9 @@ Most interesting is TestApp """ -import sys import random -import urllib import warnings import mimetypes -import time import cgi import os import re @@ -33,6 +30,7 @@ from webtest.compat import to_string from webtest.compat import to_bytes from webtest.compat import join_bytes +from webtest.compat import OrderedDict from webtest.compat import dumps from webtest.compat import loads from webtest.compat import PY3 @@ -41,7 +39,7 @@ if PY3: from webtest import lint3 as lint else: - from webtest import lint + from webtest import lint # NOQA __all__ = ['TestApp', 'TestRequest'] @@ -51,28 +49,26 @@ class AppError(Exception): - pass - - -class CaptureStdout(object): - - def __init__(self, actual): - self.captured = StringIO() - self.actual = actual - - def write(self, s): - self.captured.write(s) - self.actual.write(s) - - def flush(self): - self.actual.flush() - - def writelines(self, lines): - for item in lines: - self.write(item) - def getvalue(self): - return self.captured.getvalue() + def __init__(self, message, *args): + message = to_string(message) + str_args = () + for arg in args: + if isinstance(arg, Response): + body = arg.body + if isinstance(body, binary_type): + if arg.charset: + arg = body.decode(arg.charset) + else: + arg = repr(body) + elif isinstance(arg, binary_type): + try: + arg = to_string(arg) + except UnicodeDecodeError: + arg = repr(arg) + str_args += (arg,) + message = message % str_args + Exception.__init__(self, message) class TestResponse(Response): @@ -806,8 +802,8 @@ expect_errors=expect_errors, content_type=content_type) - def post_json(self, url, params='', headers=None, extra_environ=None, - status=None, expect_errors=False): + def post_json(self, url, params=NoDefault, headers=None, + extra_environ=None, status=None, expect_errors=False): """ Do a POST request. Very like the ``.get()`` method. ``params`` are dumps to json and put in the body of the request. @@ -816,7 +812,7 @@ Returns a ``webob.Response`` object. """ content_type = 'application/json' - if params: + if params is not NoDefault: params = dumps(params) return self._gen_request('POST', url, params=params, headers=headers, extra_environ=extra_environ, status=status, @@ -842,7 +838,7 @@ expect_errors=expect_errors, content_type=content_type) - def put_json(self, url, params='', headers=None, extra_environ=None, + def put_json(self, url, params=NoDefault, headers=None, extra_environ=None, status=None, expect_errors=False): """ Do a PUT request. Very like the ``.post()`` method. @@ -852,7 +848,7 @@ Returns a ``webob.Response`` object. """ content_type = 'application/json' - if params: + if params is not NoDefault: params = dumps(params) return self._gen_request('PUT', url, params=params, headers=headers, extra_environ=extra_environ, status=status, @@ -877,8 +873,8 @@ expect_errors=expect_errors, content_type=content_type) - def delete_json(self, url, params='', headers=None, extra_environ=None, - status=None, expect_errors=False): + def delete_json(self, url, params=NoDefault, headers=None, + extra_environ=None, status=None, expect_errors=False): """ Do a DELETE request. Very like the ``.get()`` method. Content-Type is set to ``application/json``. @@ -890,7 +886,7 @@ 'DELETE request. Most web servers will ignore it'), lint.WSGIWarning) content_type = 'application/json' - if params: + if params is not NoDefault: params = dumps(params) return self._gen_request('DELETE', url, params=params, headers=headers, extra_environ=extra_environ, status=status, @@ -1043,17 +1039,9 @@ req.environ['paste.testing'] = True req.environ['paste.testing_variables'] = {} app = lint.middleware(self.app) - old_stdout = sys.stdout - out = CaptureStdout(old_stdout) - try: - sys.stdout = out - start_time = time.time() - ## FIXME: should it be an option to not catch exc_info? - res = req.get_response(app, catch_exc_info=True) - res._use_unicode = self.use_unicode - end_time = time.time() - finally: - sys.stdout = old_stdout + ## FIXME: should it be an option to not catch exc_info? + res = req.get_response(app, catch_exc_info=True) + res._use_unicode = self.use_unicode res.request = req res.app = app res.test_app = self @@ -1063,7 +1051,6 @@ except TypeError: pass res.errors = errors.getvalue() - total_time = end_time - start_time for name, value in req.environ['paste.testing_variables'].items(): if hasattr(res, name): raise ValueError( @@ -1098,26 +1085,26 @@ if isinstance(status, (list, tuple)): if res.status_int not in status: raise AppError( - "Bad response: %s (not one of %s for %s)\n%s" - % (res_status, ', '.join(map(str, status)), - res.request.url, res.body)) + "Bad response: %s (not one of %s for %s)\n%s", + res_status, ', '.join(map(str, status)), + res.request.url, res) return if status is None: if res.status_int >= 200 and res.status_int < 400: return raise AppError( - "Bad response: %s (not 200 OK or 3xx redirect for %s)\n%s" - % (res_status, res.request.url, - res.body)) + "Bad response: %s (not 200 OK or 3xx redirect for %s)\n%s", + res_status, res.request.url, + res) if status != res.status_int: raise AppError( - "Bad response: %s (not %s)" % (res_status, status)) + "Bad response: %s (not %s)", res_status, status) def _check_errors(self, res): errors = res.errors if errors: raise AppError( - "Application had errors logged:\n%s" % errors) + "Application had errors logged:\n%s", errors) ######################################## @@ -1458,7 +1445,7 @@ def _parse_fields(self): in_select = None in_textarea = None - fields = {} + fields = OrderedDict() for match in self._tag_re.finditer(self.text): end = match.group(1) == '/' tag = match.group(2).lower() @@ -1768,7 +1755,10 @@ v = v.replace(ent, repl) return v + def encode_params(params, content_type): + if params is NoDefault: + return '' if isinstance(params, dict) or hasattr(params, 'items'): params = list(params.items()) if isinstance(params, (list, tuple)): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/webtest/compat.py new/WebTest-1.3.4/webtest/compat.py --- old/WebTest-1.3.3/webtest/compat.py 2011-10-30 00:16:13.000000000 +0200 +++ new/WebTest-1.3.4/webtest/compat.py 2012-02-22 19:15:05.000000000 +0100 @@ -88,3 +88,15 @@ except: value = repr(value) sys.stderr.write(value) + +try: + next = next +except NameError: + # python < 2.6 + def next(iterator): + return iterator.next() + +try: + from collections import OrderedDict +except ImportError: + OrderedDict = dict diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/webtest/lint.py new/WebTest-1.3.4/webtest/lint.py --- old/WebTest-1.3.3/webtest/lint.py 2011-08-27 15:03:56.000000000 +0200 +++ new/WebTest-1.3.4/webtest/lint.py 2012-05-04 18:02:21.000000000 +0200 @@ -114,6 +114,7 @@ import re import sys import warnings +from webtest.compat import next header_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9\-_]*$') bad_header_value_re = re.compile(r'[\000-\037]') @@ -270,10 +271,7 @@ def next(self): assert not self.closed, ( "Iterator read after closed") - try: - v = next(self.iterator) - except NameError: - v = self.iterator.next() + v = next(self.iterator) if self.check_start_response is not None: assert self.check_start_response, ( "The application returns and we started iterating over its" @@ -443,7 +441,7 @@ else: assert 0, (("Content-Type header found in a %s response, " "which must not return content.") % code) - if code not in NO_MESSAGE_BODY: + if code not in NO_MESSAGE_BODY and length is not None and length > 0: assert 0, "No Content-Type header found in headers (%s)" % headers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WebTest-1.3.3/webtest/lint3.py new/WebTest-1.3.4/webtest/lint3.py --- old/WebTest-1.3.3/webtest/lint3.py 2011-08-27 15:03:56.000000000 +0200 +++ new/WebTest-1.3.4/webtest/lint3.py 2012-05-04 18:02:42.000000000 +0200 @@ -115,7 +115,6 @@ import re import sys import warnings -from webtest.compat import PY3 from webtest.compat import to_string header_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9\-_]*$') @@ -275,10 +274,7 @@ def next(self): assert not self.closed, ( "Iterator read after closed") - try: - v = next(self.iterator) - except NameError: - v = self.iterator.next() + v = next(self.iterator) if self.check_start_response is not None: assert self.check_start_response, ( "The application returns and we started iterating over its" @@ -464,7 +460,7 @@ else: assert 0, (("Content-Type header found in a %s response, " "which must not return content.") % code) - if code not in NO_MESSAGE_BODY: + if code not in NO_MESSAGE_BODY and length is not None and length > 0: assert 0, "No Content-Type header found in headers (%s)" % headers -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org