Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why "rv" in Flask testing tutorial? [closed]

I am reading Flask's tutorial about testing. There's such code there:

rv = self.app.get('/')
assert 'No entries here so far' in rv.data

My question is: why is there a variable called rv? What does this abbreviation mean?

I've been looking for it in Flask source code for a while, and I found several variables called that way:

app_rv = app(environ, start_response)

and

rv = run_wsgi_app(self.application, environ, buffered=buffered)

But, as you can see, rv here is not even possibly related to rv as response object in testing.

I've been able to find out that "r" stays probably for "response", but what does the "v" mean?

like image 751
m4tx Avatar asked Apr 07 '15 19:04

m4tx


People also ask

Which package can we use for testing Flask application?

Flask provides a way to test your application by exposing the Werkzeug test Client and handling the context locals for you. You can then use that with your favourite testing solution.


1 Answers

It says just below that code snippet in your link you provided:

By using self.app.get we can send an HTTP GET request to the application with the given path. The return value will be a response_class object.

So rv is just short for return value.

like image 109
Jorden Avatar answered Sep 25 '22 03:09

Jorden