(original) (raw)

On 07/17/2012 10:34 AM, Victor Stinner wrote:
Python 3.3 introduced os.supports\_dir\_fd to check if some os functions  
do accept a file descriptor instead of a path. The problem is that  
os.supports\_dir\_fd is a list of functions, not a list of function  
names. If os functions are monkey patched, you cannot test anymore if  
a function supports file descriptor.

If you're monkey-patching the function, you can monkey-patch os.supports\_dir\_fd too.

Monkey patching is a common practice in Python. test\_os.py replaces  
os.exec\*() functions temporary for example.  

For testing, yes.  It's not recommended for production code.


/arry