typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Add stubs for WebTest

Open Daverball opened this issue 4 months ago • 5 comments

A small testing framework for WSGI applications based around WebOb.

Source: https://github.com/Pylons/webtest/blob/3.0.6/webtest/init.py Docs: https://docs.pylonsproject.org/projects/webtest/en/latest/

webtest.forms.Form turned out a little more lax than I would've liked. But making it more strict would've probably caused quite a bit of churn in test code, like not being able to use Checkbox.checked without first doing an isinstance check, or either having to do the same for Select.select/MultipleSelect.select_multiple or having to switch to Form.select/Form.select_multiple.

I also debated for a while on whether or not to make TestApp generic, but ultimately it seemed worth it, since if you have a test fixture that returns a TestApp, you don't necessarily want to have to specify another fixture in order to get at the WSGIApplication that's being tested with the correct type information. Giving the TypeVar a default of WSGIApplication should end up making it behave more or less the same as the non-generic version, if you don't care about being able to access the application through TestApp.app.

Daverball avatar Aug 07 '25 08:08 Daverball