From 2b17f80f7ee4cfa1346e02f85ff40438475de78c Mon Sep 17 00:00:00 2001 From: Olli Paakkunainen Date: Sun, 6 Feb 2022 13:50:50 +0900 Subject: [PATCH] Add warning to docs about new_instances method --- docs/advanced/new_instances.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/advanced/new_instances.md b/docs/advanced/new_instances.md index 22a714c..c4254bd 100644 --- a/docs/advanced/new_instances.md +++ b/docs/advanced/new_instances.md @@ -15,6 +15,13 @@ now been replaced by a function. Flexmock offers another alternative using the `.new_instances()` method: +!!!warning + + Usage of `.new_instances()` method is discouraged due to a bug in CPython + which prevents proper teardown of the mock. Due to this bug, the mock leaks + into other tests and can prevent creating new instances of the class. More + information in [issue #16](https://github.com/flexmock/flexmock/issues/16). + ```python >>> class Group: pass >>> fake_group = flexmock(name="fake")