[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:32:52 UTC 2010
#1007: Monkey patch os.chdir to throw an exception on call
------------------------+---------------------------------------------------
Reporter: maruel | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: 0.8.2
Version: master | Keywords:
------------------------+---------------------------------------------------
Changes (by dustin):
* milestone: undecided => 0.8.2
Old description:
> 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.
New description:
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.
--
Comment:
(fix formatting)
--
Ticket URL: <http://buildbot.net/trac/ticket/1007#comment:2>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation
More information about the Commits
mailing list