"atexit" module: PyFakeFS not active anymore at application exit #1110
-
Hello, I have a class In unit tests I use PyFakeFS to prevent writing to real disc. I observed that PyFakeFS seems not to be "active" anymore when For technical details see my PR bit-team/backintime#2003 "fixing" the problem just with removing the relevant unit tests. Of course I can mock around. But I don't want that. Might I forget any other elegant solution? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Out of the box I don't have a solution for this, and it is certainly not possible with the current You could test this by patching/overwriting |
Beta Was this translation helpful? Give feedback.
Out of the box I don't have a solution for this, and it is certainly not possible with the current
pyfakefs
usage.pyfakefs
has to make sure that the filesystem functions are restored after the test ends, and this is certainly before theatexit
hook is triggered. Just not resetting the filesystem would most probably have other unwanted side effects.You could test this by patching/overwriting
Patcher.tearDown
to do nothing and check how that will behave, though that would also mean that you have to make sure to run this test separately. Generally, I don't think that this is a good idea.