I have the following in my conftest.py for exactly the purpose of inspecting 
the state of the request in tests.



class WebTestRequest(Request):
    """A custom WebTest request that allows access to Pyramid's Request."""

    def __init__(
        self,
        environ: t.Dict,
        charset: t.Optional[str] = None,
        unicode_errors=None,
        decode_param_names=None,
        **kw
    ) -> None:
        super(WebTestRequest, self).__init__(
            environ, charset, unicode_errors, decode_param_names, **kw
        )

        # This allows us to get access to Pyramid request from WebTest
        # response: resp.app_request
        environ["paste.testing_variables"]["app_request"] = self


@pytest.fixture(scope="session")
def testapp(app: Router) -> WebTestApp:
    """Provide a webtest app for functional testing."""

    app.request_factory = WebTestRequest
    return WebTestApp(app)



Hope it helps,
z.


> On 8 Dec 2021, at 09:38, Gerhard Schmidt <esta...@augusta.de> wrote:
> 
> 
> Hi,
> 
> is there a way to access the pyramid request object webtest.TestApp.
> 
> especially in interested in the session. To test if information is stored.
> 
> Regards
>    Estartu
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to pylons-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pylons-discuss/38dca48c-d116-6ded-0f03-3a25658e14bf%40augusta.de.
> <OpenPGP_0x3EE6A5DC78826E6B.asc>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/095A1BC2-AB98-4057-9ED3-B5045D06E2FF%40gmail.com.

Reply via email to