Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new quasi-functional test using 'multipart' #22

Merged
merged 6 commits into from
May 18, 2024

Conversation

tseaver
Copy link
Member

@tseaver tseaver commented May 16, 2024

peppercorn doesn't actually use the stdlib's deprecated cgi.FieldStorage, except in a quasi-functional test
which builds one only to tear out the name-value pairs to hand to peppercorn's own 'parse'.

The rationale is that peppercorn is mostly used to parse serialized form data, passed in an HTTP POST request body encoded as multipart/form-data: because 'peppercorn' sits in the part of the WSGI space dependent mostly dominated by WebOb, which still using cgi.FieldStorage`, we have wanted to demonstrate that we could consume such data trivially.

However, the cgi module is slated to be removed from the standard library in Python 3.13.

This branch therefore adds a similar quasi-functional test, using instead the MultipartParser from the third-party multipart package recommended by PEP-594 as the appropriate replacement for cgi.FieldStorage. Perhaps it might help spark thinking about updates to WebOb for compatibility with Python >= 3.13.

peppercorn doesn't actually *use* the deprecated stdlib's
deprecated 'cgi.FieldStorage', except in a quasi-functional test
which builds one only to tear out the name-value pairs to hand to
peppercorn's own 'parse'.

The rationale here is that peppercorn is mostly used to parse serialized
form data, passed in an HTTP POST request body encoded as
'multipart/form-data'.

Because 'peppercorn' sits in the part of the WSGI space dependent mostly
dominated by 'WebOb', which still using 'cgi.FieldStorage', we have wanted
to demonstrate that we could consume such data trivially.

However, the 'cgi' module is slated to be removed from the standard
library in Python 3.13 (see: https://peps.python.org/pep-0594/#cgi).

This branch therefore adds a similar quasi-functionl test, using instead
the 'MultipartParser' from the third-party 'multipart' package.
peppercorn/tests.py Outdated Show resolved Hide resolved
@tseaver tseaver merged commit c90d787 into master May 18, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants