Commit 422c4fc
authored
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.
1 parent 6efe346 commit 422c4fc
File tree
4 files changed
+29
-5
lines changed- Lib
- test/test_unittest/testmock
- unittest
- Misc/NEWS.d/next/Library
4 files changed
+29
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2045 | 2045 | | |
2046 | 2046 | | |
2047 | 2047 | | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
2048 | 2055 | | |
2049 | 2056 | | |
2050 | 2057 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1508 | 1508 | | |
1509 | 1509 | | |
1510 | 1510 | | |
1511 | | - | |
1512 | | - | |
1513 | | - | |
1514 | | - | |
1515 | | - | |
| 1511 | + | |
| 1512 | + | |
1516 | 1513 | | |
1517 | 1514 | | |
| 1515 | + | |
| 1516 | + | |
1518 | 1517 | | |
1519 | 1518 | | |
1520 | 1519 | | |
| |||
1527 | 1526 | | |
1528 | 1527 | | |
1529 | 1528 | | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1530 | 1533 | | |
| 1534 | + | |
1531 | 1535 | | |
1532 | 1536 | | |
1533 | 1537 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments