Description
Bug report
When the feature Check against misspellings of assert etc. in mock
was introduced, the unsafe flag was moved out from kwargs and defined as a named argument.
Previously since unsafe was implicitly part of kwargs, it was silently propagated from _patch class to the instantiation of the klass variable inside the __enter__
method.
But now, the unsafe flag as an explicitly named argument is not being propagated to the instantiation of the Klass variable.
Hence the Mock class is unable to set its internal attribute _mock_unsafe
and will always be False regardless of whether the user set unsafe=True
or not.
The test cases have to be updated to show this bug.
This bug was introduced in this commit: fdb9efc (bpo-41877) and only included in versions from Python 3.10.
Your environment
- CPython versions tested on: 3.10, 3.11 and master branch.
- Operating system and architecture: Ubuntu 22.04