I am building a tests for my Flask application, in one of the test there is a need to modify a session key (which itself is a list of values), and then check that app behaviour is altered by the modified key content. I'm using an approach from Flask documentation for modifying session from tests. Here is an excerpt example code, to demonstrate the problem (I have added print statements, along with what they are printing during test run): my_app.py from flask import ( Flask, session, ) app = Flask(__name__) app.secret_key = 'bad secret key' @app.route('/create_list/', methods=['POST']) def