-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mock.patch introspects original even when new_callable set #119600
Comments
rbtcollins
added a commit
to rbtcollins/cpython
that referenced
this issue
May 27, 2024
…new_callable is set In order to patch flask.g e.g. as in python#84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe.
rbtcollins
added a commit
to rbtcollins/cpython
that referenced
this issue
May 27, 2024
…new_callable is set In order to patch flask.g e.g. as in python#84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe.
rbtcollins
added a commit
to rbtcollins/cpython
that referenced
this issue
Jun 10, 2024
…new_callable is set In order to patch flask.g e.g. as in python#84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe.
cjw296
pushed a commit
that referenced
this issue
Jun 11, 2024
…le is set (#119601) In order to patch flask.g e.g. as in #84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe.
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 11, 2024
…callable is set (pythonGH-119601) In order to patch flask.g e.g. as in pythonGH-84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe. (cherry picked from commit 422c4fc) Co-authored-by: Robert Collins <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 11, 2024
…callable is set (pythonGH-119601) In order to patch flask.g e.g. as in pythonGH-84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe. (cherry picked from commit 422c4fc) Co-authored-by: Robert Collins <[email protected]>
cjw296
pushed a commit
that referenced
this issue
Jun 11, 2024
…_callable is set (GH-119601) (#120335) gh-119600: mock: do not access attributes of original when new_callable is set (GH-119601) In order to patch flask.g e.g. as in GH-84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe. (cherry picked from commit 422c4fc) Co-authored-by: Robert Collins <[email protected]>
cjw296
pushed a commit
that referenced
this issue
Jun 11, 2024
…_callable is set (GH-119601) (#120334) gh-119600: mock: do not access attributes of original when new_callable is set (GH-119601) In order to patch flask.g e.g. as in GH-84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe. (cherry picked from commit 422c4fc) Co-authored-by: Robert Collins <[email protected]>
mrahtz
pushed a commit
to mrahtz/cpython
that referenced
this issue
Jun 30, 2024
…callable is set (python#119601) In order to patch flask.g e.g. as in python#84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe.
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this issue
Jul 11, 2024
…callable is set (python#119601) In order to patch flask.g e.g. as in python#84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe.
estyxx
pushed a commit
to estyxx/cpython
that referenced
this issue
Jul 17, 2024
…callable is set (python#119601) In order to patch flask.g e.g. as in python#84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doing autospec. However, patch("flask.g", new_callable=MagicMock) should be entirely safe.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Bug description:
In order to patch
flask.g
e.g. as in #84982, that proxies getattr must not be invoked. For that, mock must not try to read from the original object. In some cases that is unavoidable, e.g. when doingautospec
. However,patch("flask.g", new_callable=MagicMock)
should be entirely safe.CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux, macOS, Windows, Other
Linked PRs
The text was updated successfully, but these errors were encountered: