@@ -625,8 +625,7 @@ use_cache
625625.........
626626If True (the default), patched and non-patched modules are cached between tests
627627to avoid the performance hit of the file system function lookup (the
628- patching itself is reverted after each test). As this is a new
629- feature, this argument allows to turn it off in case it causes any problems:
628+ patching itself is reverted after each test). This argument allows to turn it off in case it causes any problems:
630629
631630.. code :: python
632631
@@ -635,9 +634,22 @@ feature, this argument allows to turn it off in case it causes any problems:
635634 fake_fs.create_file(" foo" , contents = " test" )
636635 ...
637636
638- Please write an issue if you encounter any problem that can be fixed by using
639- this parameter. Note that this argument may be removed in a later version, if
640- no problems come up.
637+ If using ``pytest ``, the cache is always cleared before the final test shutdown, as there has been a problem
638+ happening on shutdown related to removing the cached modules.
639+ This does not happen for other test methods so far.
640+
641+ If you think you have encountered a similar problem with ``unittest ``, you may try to clear the cache
642+ during module shutdown using the class method for clearing the cache:
643+
644+ .. code :: python
645+
646+ from pyfakefs.fake_filesystem_unittest import Patcher
647+
648+
649+ def tearDownModule ():
650+ Patcher.clear_fs_cache()
651+
652+ Please write an issue if you encounter any problem that can be fixed by using this parameter.
641653
642654If you want to clear the cache just for a specific test instead, you can call
643655``clear_cache `` on the ``Patcher `` or the ``fake_filesystem `` instance:
0 commit comments