[Buildbot-commits] [Buildbot] #1007: Monkey patch os.chdir to throw an exception on call

Buildbot buildbot-devel at lists.sourceforge.net
Mon Oct 4 14:29:54 UTC 2010


#1007: Monkey patch os.chdir to throw an exception on call
------------------------+---------------------------------------------------
Reporter:  maruel       |       Owner:           
    Type:  enhancement  |      Status:  new      
Priority:  minor        |   Milestone:  undecided
 Version:  master       |    Keywords:           
------------------------+---------------------------------------------------
 Global mutable states are dangerous and some parts of the script assumes
 os.getcwd() is immutable. To not add further side-effects, blacklist
 os.chdir() by implementing this pseudo code:

 import os
 def DoNotUseOsChDir(_):
   raise ValueError('Do not use os.chdir() in your code, you probably want
 to use path=foo or cwd=foo argument when calling out subprocesses
 instead')
 os.chdir = DoNotUseOsChDir

 or something similar.

-- 
Ticket URL: <http://buildbot.net/trac/ticket/1007>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list