Message370197
Whenever I try to patch flask.g, it appears to do nothing. This happened when I upgraded mock from 3.x to 4.x. I reported it on the mock github page https://github.com/testing-cabal/mock/issues/490 and was asked to report it here. The folllowing code run with pytest works fine in mock 3.0.5, but fails to patch in 4.0.0 and up.
from mock import patch
import flask
def some_function():
flask.g.somevariable = True
return flask.g.somevariable
@patch('flask.g')
def test_some_function(mock_flask_global):
assert some_function() |
|
Date |
User |
Action |
Args |
2020-05-28 12:19:57 | Rob Taft | set | recipients:
+ Rob Taft |
2020-05-28 12:19:57 | Rob Taft | set | messageid: <1590668397.14.0.891806096405.issue40805@roundup.psfhosted.org> |
2020-05-28 12:19:57 | Rob Taft | link | issue40805 messages |
2020-05-28 12:19:56 | Rob Taft | create | |
|