Skip to content

Commit

Permalink
This commit aggregates most of the work done at the 2011 PyCon Pyrami…
Browse files Browse the repository at this point in the history
…d sprint in Atlanta GA. Only tests updates are in it, library code changes are committed separately.

The sprint was organised by Chris McDonough and provided WebOb with 100% statement coverage.
Participated: Alexandre Conrad, Patricio Paez, Whit Morriss, Rob Miller, Reed O'Brien, Chris Shenton, Joe Dallago, Tres Seaver, Casey Duncan, Kai Groner, Chris McDonough.
The bitbucket fork on which this work was done is at https://bitbucket.org/chrism/webob-py3k and contains a detailed changelog.
A big thank you to everyone who contributed!
  • Loading branch information
maluke committed Mar 21, 2011
1 parent 1c4912a commit d57f294
Show file tree
Hide file tree
Showing 31 changed files with 6,809 additions and 830 deletions.
5 changes: 5 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WebOb.egg-info
*.pyc
*.pyo
*.swp
*~
TEST*
testenv
docs/_build/*
Expand All @@ -16,4 +17,8 @@ Session.vim
html_coverage/**
*,cover
*_fixt.py
*$py.class
.tox/
coverage.xml
nosetests.xml

30 changes: 0 additions & 30 deletions _test_mlk.py

This file was deleted.

17 changes: 17 additions & 0 deletions docs/doctests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import unittest
import doctest

def test_suite():
flags = doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE
return unittest.TestSuite((
doctest.DocFileSuite('test_request.txt', optionflags=flags),
doctest.DocFileSuite('test_response.txt', optionflags=flags),
doctest.DocFileSuite('test_dec.txt', optionflags=flags),
doctest.DocFileSuite('do-it-yourself.txt', optionflags=flags),
doctest.DocFileSuite('file-example.txt', optionflags=flags),
doctest.DocFileSuite('index.txt', optionflags=flags),
doctest.DocFileSuite('reference.txt', optionflags=flags),
))

if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
2 changes: 1 addition & 1 deletion docs/file-example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ to a high-quality file serving application.
>>> import webob, os
>>> base_dir = os.path.dirname(os.path.dirname(webob.__file__))
>>> doc_dir = os.path.join(base_dir, 'docs')
>>> from dtopt import ELLIPSIS
>>> from doctest import ELLIPSIS

First we'll setup a really simple shim around our application, which
we can use as we improve our application:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WebOb

.. comment:

>>> from dtopt import ELLIPSIS
>>> from doctest import ELLIPSIS


Status & License
Expand Down
75 changes: 75 additions & 0 deletions docs/pycon2011/pycon-py3k-sprint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Python 3 Sprint Outcomes
========================

We provided WebOb with 100% statement coverage at the 2011 PyCon Pyramid
sprint in Atlanta GA.

Participated:

Alexandre Conrad, Patricio Paez, Whit Morriss, Rob Miller, Reed O'Brien,
Chris Shenton, Joe Dallago, Tres Seaver, Casey Duncan, Kai Groner, Chris
McDonough.

In doing so, we added roughly 700-800 unit tests, and disused existing
doctests as coverage (they are still runnable, but don't get run during
``setup.py test``).

We never did get around to actually doing any porting to Python 3. Adding
comprehensive test coverage proved to be enough work to fill the sprint days.

The bitbucket fork on which this work was done is at
https://bitbucket.org/chrism/webob-py3k. I've made a tag in that repository
named "sprint-coverage" which represents a reasonable place to pull from for
integration into mainline.

Testing Normally
----------------

$ python2.x setup.py test

Testing Coverage
----------------

$ python2.X setup.py nosetests --with-coverage

Testing Documentation
---------------------

Doctests don't run when you run "setup.py test" anymore. To run them
manually, do:

$ cd webob
$ $MYVENV/bin/python setup.py develop
$ cd docs
$ $MYVENV/bin/python doctests.py

Blamelist
---------

- webob.acceptparse (aconrad)

- webob.byterange (ppaez)

- webob.cachecontrol (whit)

- webob.dec (rafrombrc)

- webob.descriptors (reedobrien)

- webob.etag (shentonfreude)

- webob.multidict (joe)

- webob.request (tseaver)

- webob.response (caseman/mcdonc)

- webob.exc (joe)

Doctest-to-Unit Test Conversion
-------------------------------

- tests/test_request.txt (aconrad)

- tests/test_response.txt (groner)

145 changes: 145 additions & 0 deletions docs/pycon2011/request_table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
==========================
Request Comparison Table
==========================

b=WebBob
z=Werkzeug
x=both


WEBOB NAME write read WERKZEUG NAME NOTES
================================= ===== ==== ================================= ===========================================

Read-Write Properties Read-Write Properties
+++++++++++++++++++++ +++++++++++++++++++++

content_type content_type CommonRequestDescriptorMixin
charset charset "utf-8"
headers headers cached_property
urlvars
urlargs
host host cached_property
body
unicode_errors 'strict' encoding_errors 'ignore'
decode_param_names F
request_body_tempfile_limit 10*1024 max_content_length None Not sure if these are the same
is_behind_proxy F
max_form_memory_size None
parameter_storage_class ImmutableMultiDict
list_storage_class ImmutableList
dict_storage_class ImmutableTypeConversionDict
environ environ
populate_request T
shallow F


Environ Getter Properties
+++++++++++++++++++++++++

body_file_raw
scheme
method method
http_version
script_name script_root cached_property
path_info ???path cached_property
content_length content_type CommonRequestDescriptorMixin
remote_user remote_user
remote_addr remote_addr
query_string query_string
server_name host (with port)
server_port host (with name)
uscript_name
upath_info
is_body_seekable
authorization authorization cached_property
pragma pragma cached_property
date date CommonRequestDescriptorMixin
max_forwards max_forwards CommonRequestDescriptorMixin
range
if_range
referer/referrer referrer CommonRequestDescriptorMixin
user_agent user_agent cached_property
input_stream
mimetype CommonRequestDescriptorMixin


Read-Only Properties
++++++++++++++++++++

host_url host_url cached_property
application_url base_url cached_property Not sure if same
path_url ???path cached_property
path ???path cached_property
path_qs ???path cached_property
url url cached_property
is_xhr is_xhr
str_POST
POST
str_GET
GET
str_params
params
str_cookies
cookies cookies cached_property
url_charset
stream cached_property
args cached_property Maybe maps to params
data cached_property
form cached_property
values cached_property Maybe maps to params
files cached_property
url_root cached_property
access_route cached_property
is_secure
is_multithread
is_multiprocess
is_run_once


Accept Properties
+++++++++++++++++

accept accept_mimetypes
accept_charset accept_charsets
accept_encoding accept_encodings
accept_language accept_languages

Etag Properties
+++++++++++++++

cache_control cache_control cached_property
if_match if_match cached_property
if_none_match if_none_match cached_property
if_modified_since if_modified_since cached_property
if_unmodified_since if_unmodified_since cached_property

Methods
++++++

relative_url
path_info_pop
path_info_peek
copy
copy_get
make_body_seekable
copy_body
make_tempfile
remove_conditional_headers
as_string (__str__)
call_application
get_response

Classmethods
++++++++++++

from_string (classmethod)
from_file
blank
from_values
application

Notes
-----

<mitsuhiko> mcdonc: script_root and path in werkzeug are not quite script_name and path_info in webob
[17:51] <mitsuhiko> the behavior regarding slashes is different for easier url joining
68 changes: 68 additions & 0 deletions docs/pycon2011/response_table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
===========================
Response Comparison Table
===========================

b=WebBob
z=Werkzeug
x=both
=neither

WEBOB NAME write read WERKZEUG NAME NOTES
================================= ===== ==== ================================= ===========================================
default_content_type x x default_mimetype wb default: "text/html", wz: "text/plain"
default_charset b b wz uses class var default for charset
charset x x charset
unicode_errors b b
default_conditional_response b b
from_file() (classmethod) b b
copy b b
status (string) x x status
status_int x x status_code
z default_status
headers b b
body b b
unicode_body x x data
body_file b File-like obj returned is writeable
app_iter b x get_app_iter()
z iter_encoded()
allow b x allow
vary b x vary
content_type x x content_type
content_type_params x x mime_type_params
z z mime_type content_type str wo parameters
content_length x x content_length
content_encoding x x content_encoding
content_language b x content_language
content_location x x content_location
content_md5 x x content_md5
content_disposition b b
accept_ranges b b
content_range b b
date x x date
expires x x expires
last_modified x x last_modified
cache_control b z cache_control
cache_expires (dwim) b b
conditional_response (bool) b x make_conditional()
etag b x add_etag()
etag b x get_etag()
etag b x set_etag()
z freeze()
location x x location
pragma b b
age x x age
retry_after x x retry_after
server b b
www_authenticate b z www_authenticate
x x date
retry_after x x retry_after
set_cookie() set_cookie()
delete_cookie() delete_cookie()
unset_cookie()
z is_streamed
z is_sequence
body_file x stream
close()
get_wsgi_headers()
get_wsgi_response()
__call__() __call__()
2 changes: 1 addition & 1 deletion docs/reference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WebOb Reference

.. comment:

>>> from dtopt import ELLIPSIS
>>> from doctest import ELLIPSIS

Introduction
============
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dec.txt → docs/test_dec.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
A test of the decorator module::

>>> from dtopt import ELLIPSIS
>>> from doctest import ELLIPSIS
>>> from webob.dec import wsgify
>>> from webob import Response, Request
>>> from webob import exc
Expand Down
Loading

0 comments on commit d57f294

Please sign in to comment.